# create a grid of parameters to search (and specify the pipeline step along with the parameter)
param_grid = {}
param_grid['countvectorizer__token_pattern'] = [r"\b\w\w+\b", r"'([a-z ]+)'"]
param_grid['multinomialnb__alpha'] = [0.5, 1]
param_grid
# pass the pipeline (instead of the model) to GridSearchCV and measuring the accuracy of the model
from sklearn.model_selection import GridSearchCV
grid = GridSearchCV(pipe, param_grid, cv=5, scoring='accuracy')
# time the grid search
%time grid.fit(X, y)
# print the single best score and parameters that produced that score
print(grid.best_score_)
print(grid.best_params_)
这是错误:
GridSearchCV'对象没有属性'best_score _'
我该如何解决?