dswah / pyGAM

[HELP REQUESTED] Generalized Additive Models in Python
https://pygam.readthedocs.io
Apache License 2.0
871 stars 159 forks source link

by-variable in pyGAM #305

Open dhops opened 3 years ago

dhops commented 3 years ago

Hi, I'm just checking on the status of "by-variables" in pyGAM. I saw that "by=" is an option, but when I create a term with by, for example s(3, by=0), the term just becomes s(3).

TheSeparatrix commented 2 years ago

As far as I understand by in pyGAM only implements factors. So if you have array X and use s(3, by=0) it internally fits to the datapoints X[3] * X[0], where X[0] are the actual numbers as floats of your 0th feature column. So if you're planning on using X[0] as a categorical variable list (as in, fit a SEPARATE spline on feature X[3] for every category provided by the categorical label in X[0]) I don't think this is supported in pyGAM. This would be a feature I would appreciate as well @dswah :)