At first I ran regular MLR model and it's okay with R2 parameter

from sklearn import linear_model

#from sklearn.feature_selection import SelectFromModel

lm = linear_model.LinearRegression()

But i need to try LOO q2 for this model and use:

from sklearn.model_selection import LeaveOneOut

from sklearn.linear_model import LinearRegression

from sklearn.model_selection import GridSearchCV parameters = {'fit_intercept':[True,False], 'normalize':[True,False], 'copy_X':[True, False]}

loo_lm = GridSearchCV(lm,parameters, cv=LeaveOneOut())

loo_lm.fit(X_train, y_train)

loo_lm.score(X_train, y_train)

So I have 'nan' and can't understand where is a mistake. When I try to use RFR and SVR there is same problems.

Similar questions and discussions