Trying to learn some Python and Sklearn, but for my work I need to run regressions that use error distributions from the Poisson, Gamma, and especially Tweedie families.

I don't see anything in the documentation about them, but they are in several parts of the R distribution, so I was wondering if anyone has seen implementations anywhere for Python. It would be extra cool if you can point me towards SGD implementations of the Tweedie distribution!

  • $\begingroup$ The most robust GLM implementations in Python are in [statsmodels]statsmodels.sourceforge.net, though I'm not sure if there are SGD implementations. $\endgroup$
    – Trey
    May 31, 2014 at 14:10
  • $\begingroup$ Thanks Trey. It looks like there's no support for Tweedie, but they do have some discussion of Poisson and Gamma distributions. $\endgroup$
    – joe
    May 31, 2014 at 21:33

2 Answers 2


Update (Jan 2023) - sklearn has Tweedie, Poisson, and gamma GLMs as of v 0.23 in May 2020.

There is movement to implement generalized linear models with Poisson, gamma, and Tweedie error distributions in scikit-learn.

Statsmodels has implementations of generalized linear models with Poisson, Tweedie, and gamma error distributions.

While I'm updating this answer, Spark ML also (experimentally) supports Poisson, Tweedie, and gamma distributions.

  • 5
    $\begingroup$ I'm working on it: github.com/madrury/py-glm $\endgroup$ Sep 1, 2017 at 13:47
  • $\begingroup$ @MatthewDrury Awesome! $\endgroup$
    – Neal
    Sep 1, 2017 at 13:54
  • $\begingroup$ @MatthewDrury nice! I just started using GLM's, and statsmodels has some limitations. Not sure I understand the math fully, but could your inner-solve be replaced with an arbitrary least-squares-type solver? I was thinking this would add flexibility (e.g. pass in sklearn.ElasticNet to get scalability/regularization/etc. "for free"?). $\endgroup$
    – GeoMatt22
    Jul 18, 2018 at 2:13

H2O has Generalized Linear Models.

They use H2O Frames though, so you can't use Pandas/Numpy directly.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.