【问题标题】:Getting 'AttributeError: Can't get attribute 'DeprecationDict' on <module 'sklearn.utils.deprecation'' this error while executing ML project执行 ML 项目时出现 'AttributeError: Can't get attribute 'DeprecationDict' on <module 'sklearn.utils.deprecation'' 这个错误
【发布时间】:2020-07-02 17:55:10
【问题描述】:

AttributeError: Can't get attribute 'DeprecationDict' on
model = pickle.load(open('rf_regression_model.pkl', 'rb')) 这一行显示错误。

【问题讨论】:

    标签: python machine-learning scikit-learn pickle


    【解决方案1】:

    您使用新版本的 sklearn 加载了由旧版本的 sklearn 训练的模型。

    所以,选项是:

    • 如果你有当前版本的 sklearn 重新训练模型 训练脚本和数据
    • 或回退到较低的 sklearn 版本 在警告消息中报告

    【讨论】:

      【解决方案2】:

      试试这个

      with open('rf_regression_model','rb') as f:
          model=pickle.load(f)
      

      【讨论】:

      • 你能提供更多关于你的模型的细节吗?谢谢
      • 我收到了一些与此错误有关的警告,例如:- FutureWarning:sklearn.ensemble.forest 模块在 0.22 版中已弃用,并将在 0.24 版中删除。应该从 sklearn.ensemble 导入相应的类/函数。任何不能从 sklearn.ensemble 导入的东西现在都是私有 API 的一部分。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-08-13
      • 1970-01-01
      • 2022-10-25
      • 1970-01-01
      • 2020-09-24
      • 2023-04-03
      • 2021-10-24
      相关资源
      最近更新 更多