问题描述
我正在尝试将网格搜索与我的SVR模型一起使用,由于要花费太多时间来适应,我想知道是否可以使用尽早停止功能,但是我不知道该怎么做。 相反,我使用了max_iter,但仍然不确定我的最佳参数。有什么建议吗?谢谢!
#We can use a grid search to find the best parameters for this model. Lets try
#X_feat = F_DF.drop(columns=feat)
y = F_DF["Production_MW"]
X_train,X_test,y_train,y_test = train_test_split(X,y,test_size=0.2,random_state=42)
#Define a list of parameters for the models
params = {'C': [0.001,0.01,0.1,1,10,100],'gamma': [0.001,'epsilon': [0.001,100]
}
#searchcv.fit(X,callback=on_step)
#We can build Grid Search model using the above parameters.
#cv=5 means cross validation with 5 folds
grid_search = GridSearchCV(SVR(kernel='rbf'),params,cv=5,n_jobs=-1,verbose=1)
grid_search.fit(X_train,y_train)
print("train score - " + str(grid_search.score(X_train,y_train)))
print("test score - " + str(grid_search.score(X_test,y_test)))
print("SVR GridSearch score: "+str(grid_search.best_score_))
print("SVR GridSearch params: ")
print(grid_search.best_params_)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)