← all repositories
dswah/pyGAM

Interpretable curves without the feature-engineering slog

pyGAM brings Generalized Additive Models to Python, trading black-box accuracy for curves you can actually explain to your PM.

1k stars Python ML Frameworks
pyGAM
Velocity · 7d
+0.3
★ / day
Trend
steady
star history

What it does

pyGAM fits Generalized Additive Models—essentially GLMs where each feature gets its own smooth, non-linear function instead of a single coefficient. It uses penalized B-splines to learn those curves automatically, so you don’t hand-craft log-transforms or polynomial features. The API apes scikit-learn, and it supports the usual link families (normal, binomial, Poisson, etc.).

The interesting bit

The additivity is the point, not a limitation. Because each feature’s contribution is separate, you can inspect f_i(X_i) in isolation—useful when “model interpretability” isn’t just a slide-deck promise. The penalty on the B-splines also reins in wiggliness without you tuning knot counts by hand.

Key highlights

  • scikit-learn-style fit/predict API; should drop into existing pipelines with minimal friction
  • Built-in distributions and link functions, with hooks to add your own
  • Penalized B-splines handle non-linearity automatically via P-spline machinery
  • Active maintenance as of v0.12.0 (March 2025), with conda-forge and PyPI packaging
  • Sponsored by GC.OS, with Discord and open issue tracker for contributors

Caveats

  • The README flags MKL acceleration as “a bit tricky” to set up; performance on large constrained models may disappoint without it
  • Explicit call for contributors and bug-hunters suggests the project is leanly staffed

Verdict

Worth a look if you need more flexibility than a linear model but can’t defend a random forest’s internals to stakeholders. Skip it if you need feature interactions or deep learning-scale capacity—GAMs are deliberately additive, and pyGAM doesn’t pretend otherwise.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.