SVM 分类器中的 Python 错误.predict()

laz*_*aza 6 python classification svm scikit-learn

当我在 Python 中使用以下命令对新数据进行分类时,出现以下错误:

classifier.predict(new_data)
Run Code Online (Sandbox Code Playgroud)

AttributeError: python 'SVC' 对象没有属性 _dual_coef_

不过,在我的笔记本电脑中,该命令运行正常!怎么了?

小智 8

AttributeError: python 'SVC' object has no attribute _dual_coef_ 当我尝试在 scikit-learn 0.16.1 版中运行使用 scikit-learn 0.15.2 版训练的模型时,我遇到了这个确切的错误 。我确实通过在最新的 scikit-learn 0.16.1 中重新训练模型来解决它。

确保您正在加载正确版本的软件包。


far*_*awa 1

您是否加载了您尝试预测所依据的模型?在这种情况下,可能是版本冲突,请尝试使用相同的 sklearn 版本重新学习模型。您可以在这里看到类似的问题:Sklearn error: 'SVR' object has no attribute '_impl'