dswah / pyGAM

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

term.__setattr___ could be conflict with term._validate_argument #230

Open chiqunz opened 5 years ago

chiqunz commented 5 years ago

In terms.py line 1008, it is possible to violate term.validate_argument if I set n_splines and spline_order as a list. For example:

kwargs = {n_splines=[2, 100, 10, 5], spline_order=[1, 3, 1, 3]}
LinearGAM(**kwargs).fit(X, y)

I believer the reason is the default spline_order is 3 and we set n_splines before spline_order. So we could come across a case n_splines = 2 and spline_order=3 which will fail in validate_argument.