最佳估计器拟合如何在随机搜索中起作用?
我将随机搜索(RSCV)与带有评估集的LGBMClassifier的默认5倍CV一起使用。
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
model_LGBM=LGBMClassifier(objective='binary',metric='auc',random_state=0,early_stopping_round=100)
distributions = dict(max_depth=range(1,10),
num_leaves=[50,100,150],
learning_rate=[0.1,0.2,0.3],
)
clf = RandomizedSearchCV(model_LGBM, distributions, random_state=0,n_iter=100,verbose=10)
clf.fit(X_train,y_train,eval_set=(X_test,y_test))
因此,RSCV的输出看起来像:
First iter: CV 1/5, "valid0's" CV 2/5 "valid0's", ..., CV 5/5 "valid0's";
Second iter: CV 1/5 "valid0's", CV 2/5 "valid0's", ..., CV 5/5 "valid0's";
...
Last iter: CV 1/5 "valid0's", CV 2/5 "valid0's", ..., CV 5/5 "valid0's";
+1 fit with "valid0's"
我想最后一个拟合是改装的最佳估计器。它使用整个训练集吗?它在哪里使用评估集?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据文档(现在 revit 参数为
true
(它是由默认值)该模型在末尾使用输入的整个数据集(在这种情况下的火车数据)上找到的最佳参数进行了训练。According to the docs (present here), if the
refit
parameter isTrue
(which it is by default) the model get trained at the end using the best parameters found on the entire dataset (train data in this case) inputted.