Skip to content

Commit

Permalink
Merge pull request #204 from dswah/signature
Browse files Browse the repository at this point in the history
improve functions signature for minimal terms
  • Loading branch information
dswah authored Sep 20, 2018
2 parents 7115424 + c342664 commit 5db3203
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
16 changes: 8 additions & 8 deletions pygam/pygam.py
Original file line number Diff line number Diff line change
Expand Up @@ -2799,10 +2799,10 @@ class GammaGAM(GAM):
be positive. The log link guarantees this.
If you need to use the inverse link function, simply construct a custom GAM:
```
from pygam import GAM
gam = GAM(distribution='gamma', link='inverse')
```
>>> from pygam import GAM
>>> gam = GAM(distribution='gamma', link='inverse')
Parameters
----------
Expand Down Expand Up @@ -2907,10 +2907,10 @@ class InvGaussGAM(GAM):
be positive. The log link guarantees this.
If you need to use the inverse squared link function, simply construct a custom GAM:
```
from pygam import GAM
gam = GAM(distribution='inv_gauss', link='inv_squared')
```
>>> from pygam import GAM
>>> gam = GAM(distribution='inv_gauss', link='inv_squared')
Parameters
----------
Expand Down
19 changes: 12 additions & 7 deletions pygam/terms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1627,32 +1627,37 @@ def build_constraints(self, coefs, constraint_lam, constraint_l2):
return sp.sparse.block_diag(C)

# Minimal representations
def l(*args, **kwargs):
def l(feature, lam=0.6, penalties='auto', verbose=False):
"""
See Also
--------
LinearTerm : for developer details
"""
return LinearTerm(*args, **kwargs)
return LinearTerm(feature=feature, lam=lam, penalties=penalties, verbose=verbose)

def s(*args, **kwargs):
def s(feature, n_splines=20, spline_order=3, lam=0.6,
penalties='auto', constraints=None, dtype='numerical',
basis='ps', by=None, verbose=False):
"""
See Also
--------
SplineTerm : for developer details
"""
return SplineTerm(*args, **kwargs)
return SplineTerm(feature=feature, n_splines=n_splines, lam=lam,
penalties=penalties, constraints=constraints,
dtype=dtype, basis=basis, by=by, verbose=verbose)

def f(*args, **kwargs):
def f(feature, lam=0.6, penalties='auto', coding='one-hot', verbose=False):
"""
See Also
--------
FactorTerm : for developer details
"""
return FactorTerm(*args, **kwargs)
return FactorTerm(feature=feature, lam=lam, penalties=penalties,
coding=coding, verbose=verbose)

def te(*args, **kwargs):
"""
Expand Down

0 comments on commit 5db3203

Please sign in to comment.