【问题标题】:joblib.load and pickle.load error "No attribute 'XGBoostLabelEncoder'"joblib.load 和 pickle.load 错误“没有属性 'XGBoostLabelEncoder'”
【发布时间】:2020-08-28 13:38:27
【问题描述】:

我正在尝试使用 joblib 和 pickle 加载 XBGClassifier 模型。

使用 joblib loaded_model = joblib.load('trained_model.sav') 时出现以下错误:AttributeError: module 'xgboost.compat' has no attribute 'XGBoostLabelEncoder'

使用 pickle loaded_model = pickle.load(open('trained_model.sav', 'rb')) 我得到 AttributeError: Can't get attribute 'XGBoostLabelEncoder' on

我再次安装了xgboost,但它不起作用,可能是什么问题?

【问题讨论】:

  • 你保存了什么?那命令是什么?因为像 XGBoostLabelEncoder 这样的东西不存在 AFAIK。

标签: python pickle xgboost joblib


【解决方案1】:

确保保存和加载环境中的 xgboost 版本相同。您需要在您尝试加载模型的环境中更改 xgboost 的版本。

【讨论】:

    猜你喜欢
    • 2021-12-07
    • 2022-09-24
    • 2021-03-10
    • 1970-01-01
    • 2020-12-11
    • 1970-01-01
    • 2022-11-04
    • 2022-07-17
    • 1970-01-01
    相关资源
    最近更新 更多