【问题标题】:Is there a way to return hyperparameters tuned by Pycaret?有没有办法返回由 Pycaret 调整的超参数?
【发布时间】:2020-11-13 11:27:39
【问题描述】:

Pycaret 自动搜索最佳参数。例如,下面的代码会将 5 个自动调整的模型分配给“tuned_top5”。

from pycaret.classification import *
setup(data=train, train_size=.9, target='my_target_feature')
tuned_top5 = [tune_model(model) for model in top5]

但是,这对我来说还不够。我想知道超参数的确切名称和值。例如,如果此代码将 max_depth 调整为 9,我希望打印“max_depth=9”或类似的结果。

有什么办法吗?

【问题讨论】:

    标签: python machine-learning hyperparameters pycaret


    【解决方案1】:

    可以从模型中拉出参数的名称,直接打印出来:

    print(tuned_top5.get_all_params())
    

    如果您只对单个参数或一小段参数感兴趣,则将它们单独拉出来打印。

    params = tuned_top5.get_all_params()
    print("max depth = ', params['max_depth'])
    

    【讨论】:

    • 最好在您发布的代码中添加描述,这样可以很好地解释和提供信息。
    猜你喜欢
    • 2023-02-08
    • 1970-01-01
    • 2012-01-06
    • 1970-01-01
    • 2021-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多