Skip to content

Commit

Permalink
Merge pull request #181 from dswah/verbose
Browse files Browse the repository at this point in the history
add verbosity option to each model class
  • Loading branch information
dswah authored Jul 6, 2018
2 parents 08e7afa + 9a497d3 commit 77c82e5
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions pygam/pygam.py
Original file line number Diff line number Diff line change
Expand Up @@ -2523,6 +2523,9 @@ class LinearGAM(GAM):
tol : float, default: 1e-4
Tolerance for stopping criteria.
verbose : bool, default: False
whether to show pyGAM warnings
Attributes
----------
coef_ : array, shape (n_classes, m_features)
Expand Down Expand Up @@ -2556,7 +2559,7 @@ def __init__(self, lam=0.6, max_iter=100, n_splines=25, spline_order=3,
penalties='auto', dtype='auto', tol=1e-4, scale=None,
callbacks=['deviance', 'diffs'],
fit_intercept=True, fit_linear=False, fit_splines=True,
constraints=None):
constraints=None, verbose=False):
self.scale = scale
super(LinearGAM, self).__init__(distribution=NormalDist(scale=self.scale),
link='identity',
Expand All @@ -2571,7 +2574,8 @@ def __init__(self, lam=0.6, max_iter=100, n_splines=25, spline_order=3,
fit_intercept=fit_intercept,
fit_linear=fit_linear,
fit_splines=fit_splines,
constraints=constraints)
constraints=constraints,
verbose=verbose)

self._exclude += ['distribution', 'link']

Expand Down Expand Up @@ -2718,6 +2722,9 @@ class LogisticGAM(GAM):
tol : float, default: 1e-4
Tolerance for stopping criteria.
verbose : bool, default: False
whether to show pyGAM warnings
Attributes
----------
coef_ : array, shape (n_classes, m_features)
Expand Down Expand Up @@ -2751,7 +2758,7 @@ def __init__(self, lam=0.6, max_iter=100, n_splines=25, spline_order=3,
penalties='auto', dtype='auto', tol=1e-4,
callbacks=['deviance', 'diffs', 'accuracy'],
fit_intercept=True, fit_linear=False, fit_splines=True,
constraints=None):
constraints=None, verbose=False):

# call super
super(LogisticGAM, self).__init__(distribution='binomial',
Expand All @@ -2767,7 +2774,8 @@ def __init__(self, lam=0.6, max_iter=100, n_splines=25, spline_order=3,
fit_intercept=fit_intercept,
fit_linear=fit_linear,
fit_splines=fit_splines,
constraints=constraints)
constraints=constraints,
verbose=verbose)
# ignore any variables
self._exclude += ['distribution', 'link']

Expand Down Expand Up @@ -2939,6 +2947,9 @@ class PoissonGAM(GAM):
tol : float, default: 1e-4
Tolerance for stopping criteria.
verbose : bool, default: False
whether to show pyGAM warnings
Attributes
----------
coef_ : array, shape (n_classes, m_features)
Expand Down Expand Up @@ -2972,7 +2983,7 @@ def __init__(self, lam=0.6, max_iter=100, n_splines=25, spline_order=3,
penalties='auto', dtype='auto', tol=1e-4,
callbacks=['deviance', 'diffs'],
fit_intercept=True, fit_linear=False, fit_splines=True,
constraints=None):
constraints=None, verbose=False):

# call super
super(PoissonGAM, self).__init__(distribution='poisson',
Expand All @@ -2988,7 +2999,8 @@ def __init__(self, lam=0.6, max_iter=100, n_splines=25, spline_order=3,
fit_intercept=fit_intercept,
fit_linear=fit_linear,
fit_splines=fit_splines,
constraints=constraints)
constraints=constraints,
verbose=verbose)
# ignore any variables
self._exclude += ['distribution', 'link']

Expand Down Expand Up @@ -3363,6 +3375,9 @@ class GammaGAM(GAM):
tol : float, default: 1e-4
Tolerance for stopping criteria.
verbose : bool, default: False
whether to show pyGAM warnings
Attributes
----------
coef_ : array, shape (n_classes, m_features)
Expand Down Expand Up @@ -3396,7 +3411,7 @@ def __init__(self, lam=0.6, max_iter=100, n_splines=25, spline_order=3,
penalties='auto', dtype='auto', tol=1e-4, scale=None,
callbacks=['deviance', 'diffs'],
fit_intercept=True, fit_linear=False, fit_splines=True,
constraints=None):
constraints=None, verbose=False):
self.scale = scale
super(GammaGAM, self).__init__(distribution=GammaDist(scale=self.scale),
link='log',
Expand All @@ -3411,7 +3426,8 @@ def __init__(self, lam=0.6, max_iter=100, n_splines=25, spline_order=3,
fit_intercept=fit_intercept,
fit_linear=fit_linear,
fit_splines=fit_splines,
constraints=constraints)
constraints=constraints,
verbose=verbose)

self._exclude += ['distribution', 'link']

Expand Down Expand Up @@ -3549,6 +3565,9 @@ class InvGaussGAM(GAM):
tol : float, default: 1e-4
Tolerance for stopping criteria.
verbose : bool, default: False
whether to show pyGAM warnings
Attributes
----------
coef_ : array, shape (n_classes, m_features)
Expand Down Expand Up @@ -3582,7 +3601,7 @@ def __init__(self, lam=0.6, max_iter=100, n_splines=25, spline_order=3,
penalties='auto', dtype='auto', tol=1e-4, scale=None,
callbacks=['deviance', 'diffs'],
fit_intercept=True, fit_linear=False, fit_splines=True,
constraints=None):
constraints=None, verbose=False):
self.scale = scale
super(InvGaussGAM, self).__init__(distribution=InvGaussDist(scale=self.scale),
link='log',
Expand All @@ -3597,7 +3616,8 @@ def __init__(self, lam=0.6, max_iter=100, n_splines=25, spline_order=3,
fit_intercept=fit_intercept,
fit_linear=fit_linear,
fit_splines=fit_splines,
constraints=constraints)
constraints=constraints,
verbose=verbose)

self._exclude += ['distribution', 'link']

Expand Down

0 comments on commit 77c82e5

Please sign in to comment.