Open TimZaragori opened 5 years ago
@TimZaragori ahh good catch, that is annoying! I'm not sure why gridsearch()
is more picky than fit()
about the dimensionality of X
.
For now, you can add another dimension to X
.
GAM().gridsearch(X[:,None], y)
I'm using pyGAM as curve fitting to compare it to function fitted with non-linear least squares method. Thus my data set is composed of only one feature. It seems that
gam = GAM().gridsearch(X,y)
doesn't work if X has only one feature and only if the GAM was not previously fitted. The error raise is :ValueError: not enough values to unpack (expected 2, got 1)
coming fromself._validate_data_dep_params(X)
because ofn_samples, m_features = X.shape
(line 273 of pygam.py). Considering X has only one feature, so something likeX = array([x1, x2, ..., xN])
,X.shape
returns(len(X),)
and therefore only one value to unpack.There is no error if we use
gam = GAM().fit(X,y)
beforegam.gridsearch(X,y)
because there is no need to validate the parameters first. It is still a bit strange because there is also the call ofself._validate_data_dep_params(X)
in theGAM().fit(X,y)
fuction and it's working. Is it due to this part of code just before the call?# validate data
y = check_y(y, self.link, self.distribution, verbose=self.verbose)
X = check_X(X, verbose=self.verbose)
check_X_y(X, y)
Feel free to ask for more information if needed.