dswah / pyGAM

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

Question about penalty terms #272

Closed kaibenning closed 3 years ago

kaibenning commented 4 years ago

Thank you for this awesome library!

If I set constraints e.g. monotonic decreasing to a term s() of the Linear-GAM, is the penalty on the second-order-derivate still applied? Will I have a for the monotonic constraint and a for the second-order-derivative penalty or just one?

The gam.summary() method gives me just []. Is this the expected behaviour? And if i want to can I do both?

shyamcody commented 4 years ago

You can provide as many lambdas as many penalties you provide. There is a check in the generic Term class to check that if lambda is iterable and penalties parameter is iterable, then whether they are the same or not. If not the same, it raises a valueError. Also, for constraints, internally a strong lam is provided(1e9). You can't access this parameter from the user end, neither gam.summary() will output this value.

kaibenning commented 3 years ago

Thank you! : )