我尝试使用Gridsearch建立岭回归模型。我得到两个分数值。有人可以解释这两个分数的差异吗,这两个值之间的我的岭回归表现分数是多少?
from sklearn.linear_model import Ridge
ridge_reg = Ridge()
from sklearn.model_selection import GridSearchCV
params_Ridge = {'alpha': [1,0.1,0.01,0.001,0.0001,0] , "fit_intercept": [True, False]}
Ridge_GS = GridSearchCV(ridge_reg, param_grid=params_Ridge)
Ridge_GS.fit(x_train,y_train)
Ridge_GS.best_params_
#*{'alpha': 1, 'fit_intercept': True}*
Ridge_GS.score(x_test,y_test)
这是我尝试的第二种方式
ridge_model = Ridge(random_state=3, **Ridge_GS.best_params_)
ridge_model.fit(x_test,y_test)
ridge_model.score(x_test,y_test)