I have a dataset with 158 rows and 10 columns. I am trying to build several linear regression models and try to predict the future value.
I used GridSearchCV to configure the settings.
Here is my GridSearchCV and regression function:
def GridSearch(data): X_train, X_test, y_train, y_test = cross_validation.train_test_split(data, ground_truth_data, test_size=0.3, random_state = 0) parameters = {'fit_intercept':[True,False], 'normalize':[True,False], 'copy_X':[True, False]} model = linear_model.LinearRegression() grid = GridSearchCV(model,parameters) grid.fit(X_train, y_train) predictions = grid.predict(X_test) print "Grid best score: ", grid.best_score_ print "Grid score function: ", grid.score(X_test,y_test)
The output of this code is:
Best rated netting: 0.720298870251
Grid Rating Function: 0.888263112299
The question is, what is the difference between best_score_ and score function?
How can the score function be better than the best_score function?
Thanks in advance.
source share