dswah / pyGAM

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

gridsearch raising invalid key error #246

Open DifferentiableProgramming opened 5 years ago

DifferentiableProgramming commented 5 years ago

When using LinearGAM.gridsearch(X, y) on any dataset, e.g. Boston house prices as follows:

from pygam import LinearGAM
from sklearn.datasets import load_boston
boston = load_boston()
X = pd.DataFrame(boston.data, columns=boston.feature_names)
y = pd.Series(boston.target)
gam = LinearGAM(n_splines=10).gridsearch(X, y)

it results in: TypeError: '(slice(None, None, None), 0)' is an invalid key

Will be happy to submit any additional info.

FerusAndBeyond commented 5 years ago

Also got this, the issue seem to be with the pandas dataframe. Simply do:

LinearGAM(n_splines=10).gridsearch(X.values, y.values)

and it works.