【问题标题】:Multi-scoring input RandomizedSearchCV多评分输入 RandomizedSearchCV
【发布时间】:2021-05-04 03:36:22
【问题描述】:

我知道您可以在执行RandomizedSearchCV 时输入多个记分器,但我找不到哪个将用于优化。

scoring = {'Log loss': 'neg_log_loss', 'AUC': 'roc_auc', 'F1': 'f1', 'Bal Acc': 'balanced_accuracy'}

search_RF = RandomizedSearchCV(RF_model, parameters_RF, scoring = scoring, 
                                n_jobs = -1, cv = cv_RSKFCV, n_iter = 200,
                                random_state = 2504).fit(X_train, y_train)

在上面的例子中,是否会优化'neg_log_loss'

【问题讨论】:

    标签: python scikit-learn cross-validation scoring


    【解决方案1】:

    它会优化所有这些,一次考虑一个。 您可以在search_RF.cv_results_ 中查看所有结果。

    您还应该使用refit 参数,而不是将其保留为默认值,因为如果您尝试运行search_RF.best_estimator_,则会收到错误消息。

    点击以下链接了解更多详情:

    https://scikit-learn.org/stable/auto_examples/model_selection/plot_multi_metric_evaluation.html#sphx-glr-auto-examples-model-selection-plot-multi-metric-evaluation-py

    https://scikit-learn.org/stable/modules/grid_search.html#multimetric-grid-search

    【讨论】:

    • 嗨钱丹!感谢您的评论。有没有一种方法可以优化 neg_log_loss 但只打印其他得分?我以为改装默认是真的?
    • 使用 Refit = 'neg_log_loss' 然后 search_RF.best_estimator_ 将只打印 neg_log_loss 并且您可以从 search_RF.cv_results_ 中获取其他参数
    • 这是一个非常好的建议。谢谢!
    • @Oorschelp 欢迎来到 SO;口头感谢是可以的,但如果答案解决了您的问题,请接受 - 见What should I do when someone answers my question?
    猜你喜欢
    • 1970-01-01
    • 2020-10-21
    • 1970-01-01
    • 2018-11-05
    • 1970-01-01
    • 2021-05-04
    • 2021-11-23
    • 1970-01-01
    • 2016-07-30
    相关资源
    最近更新 更多