gpt4 book ai didi

python-3.x - Pycaret.regression.compare_models : Evaluation table neither returned nor shown

转载 作者:行者123 更新时间:2023-12-05 02:00:36 27 4
gpt4 key购买 nike

pycaret 是一个非常紧凑的工具,用于比较我想用于模型选择的模型。不幸的是,方法 compare_models 没有显示典型的 output table你随处可见。我在 PyCharm 中使用 pycaret 而不是 Jupyter Notebook,这似乎是典型的方法。我确实得到了最好的模型作为返回值,但我真正的目标是概览表。参数 silent 是否设置为 TrueFalse 似乎也没有区别派生的数据类型是正确的。

非常感谢!

系统:Python 3.6pycaret 2.3中央操作系统 7PyCharm 2020.1 社区版

我的代码:

    regression.setup(data=ml_df,
target='occupation',
n_jobs=6,
categorical_features=['cluster', 'vacation', 'long_weekend', 'month', 'hour', 'weekday'],
numeric_features=['temperature', 'precipitation'],
silent=False
)
best_regression_models = regression.compare_models()

categorisation = [
[-0.1, 'empty'],
[0.01, 'partial'],
[0.99, 'full']
]
ml_df['occupation'] = modelling_utils.convert_number_to_categorical(ml_df['occupation'], categorisation)
classification.setup(data=ml_df,
target='occupation',
n_jobs=6,
categorical_features=['cluster', 'vacation', 'long_weekend', 'month', 'hour', 'weekday'],
numeric_features=['temperature', 'precipitation'],
fix_imbalance=True,
silent=False)
best_classification_models = classification.compare_models()

完整输出有点冗长并保存here .

编辑:代码在 Jupyter Notebook 中按预期工作

最佳答案

与从 Jupyter notebook 运行相比,从终端/命令行运行 PyCaret 具有不同的行为。在您的情况下,如果您想显示比较输出表,请在 compare_models() 函数调用之后添加这两行:

..
best_regression_models = regression.compare_models()


regression_results = pull()
print(regression_results)

pull() 函数还将返回最后一个得分网格与其他训练函数,例如 create_model()。目前此功能仅适用于回归和分类模块。

引用:https://pycaret.org/pull/

已更新引用:

关于python-3.x - Pycaret.regression.compare_models : Evaluation table neither returned nor shown,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67174729/

27 4 0