AttributeError: Can't get attribute 'DeprecationDict' on
Showing erro,python,machine-learning,scikit-learn,pickle"/>

首页 > 解决方案 > 获取'AttributeError:无法获取属性'DeprecationDict'

AttributeError: Can't get attribute 'DeprecationDict' on
Showing erro

问题描述

AttributeError: Can't get attribute 'DeprecationDict' on
Showing error in model = pickle.load(open('rf_regression_model.pkl', 'rb'))this line。


尝试这个

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

标签: pythonmachine-learningscikit-learnpickle

解决方案


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

所以,选项是:

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

推荐阅读