有点迷糊了。。网格搜索前,模型是否需要fit下呢?
也就是下面代码对不对?
params_1 = {'max_features':range(3,11,2)}
rf1 = RandomForestClassifier(n_estimators=100,oob_score=True)
rf1.fit(X1,y1) #这个语句到底要不要加?
grid1 = GridSearchCV(rf1,cv =kfold,param_grid =params_1)
grid1.fit(X1,y1)
print(grid1.best_params_,grid1.best_score_)