17

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.

Pylander
  • 425
  • 1
  • 4
  • 10
  • statsmodels had a GSOC project for GAM and penalized splines https://github.com/statsmodels/statsmodels/pull/2744 – Josef Mar 05 '16 at 03:13
  • @user333700 Interesting. Is this distinct from the scikit-learn GSOC '15 project described here? : https://github.com/scikit-learn/scikit-learn/wiki/Google-summer-of-code-(GSOC)-2015 – Pylander Mar 06 '16 at 21:39
  • 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. – Josef Mar 06 '16 at 22:42

3 Answers3

25

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.

Ferdi
  • 4,882
  • 7
  • 42
  • 62
dswah
  • 411
  • 5
  • 8
2

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.

malmgrek
  • 21
  • 1
2

Another recent development are neural additive models which apply the GAM approach to a deep learning architecture:

https://arxiv.org/abs/2004.13912

https://github.com/nickfrosst/neural_additive_models

Pylander
  • 425
  • 1
  • 4
  • 10