From 5a1479ca850bd3e3642e2ff104d9db1562b0a9ef Mon Sep 17 00:00:00 2001 From: dswah Date: Thu, 20 Sep 2018 23:47:34 +0200 Subject: [PATCH 1/2] improve functions signature for minimal terms --- pygam/terms.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/pygam/terms.py b/pygam/terms.py index 239157d8..74287cba 100644 --- a/pygam/terms.py +++ b/pygam/terms.py @@ -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): """ From c3426645e4c103611550742bb7c0241931081633 Mon Sep 17 00:00:00 2001 From: dswah Date: Fri, 21 Sep 2018 00:10:43 +0200 Subject: [PATCH 2/2] formatting --- pygam/pygam.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pygam/pygam.py b/pygam/pygam.py index 1e4ab1b5..e373c4a9 100644 --- a/pygam/pygam.py +++ b/pygam/pygam.py @@ -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 ---------- @@ -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 ----------