I know that R has gam and mgcv libraries for generalized additive models. But I am having difficulty finding their counterparts in the Python ecosystem (statsmodels only has prototype in the sandbox). Is anyone aware of existing python libraries? Who knows this might be a good project to develop/contribute to scikit-learn if not.
-
$\begingroup$ statsmodels had a GSOC project for GAM and penalized splines github.com/statsmodels/statsmodels/pull/2744 $\endgroup$– JosefCommented Mar 5, 2016 at 3:13
-
$\begingroup$ @user333700 Interesting. Is this distinct from the scikit-learn GSOC '15 project described here? : github.com/scikit-learn/scikit-learn/wiki/… $\endgroup$– PylanderCommented Mar 6, 2016 at 21:39
-
$\begingroup$ It's completely independent of scikit-learn. In the first round, as in the PR, only GLM will be supported. scikit-learn didn't have a GSOC project for it, AFAIK. $\endgroup$– JosefCommented Mar 6, 2016 at 22:42
3 Answers
I've written a Python implementation of GAMs using penalized B-splines.
check it out here: https://github.com/dswah/pyGAM
I've included lots of link functions, distributions and features.
Another option for quick experimentation with GAM models is the package https://github.com/malmgrek/gammy.
The emphasis is on Bayesian modeling of the GAM coefficients as well as easy extensibility on custom basis functions. Currently e.g. Gaussian processes, B-splines, as well as different trivial constructs.
Another recent development are neural additive models which apply the GAM approach to a deep learning architecture: