Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python error in SVM classifier.predict()

I am getting the following error when i perform classification of new data with the following command in Python:

classifier.predict(new_data)

AttributeError: python 'SVC' object has no attribute _dual_coef_

In my laptop though, the command works fine! What's wrong?

like image 452
azal Avatar asked Apr 21 '15 13:04

azal


2 Answers

I had this exact error AttributeError: python 'SVC' object has no attribute _dual_coef_ with a model trained using scikit-learn version 0.15.2, when I tried to run it in scikit-learn version 0.16.1. I did solve it by re-training the model in the latest scikit-learn 0.16.1.

Make sure you are loading the right version of the package.

like image 193
Jakub Avatar answered Sep 29 '22 07:09

Jakub


Have you loaded the model based on which you try to predict? In this case it can be a version conflict, try to re-learn the model using the same sklearn version. You can see a similar problem here: Sklearn error: 'SVR' object has no attribute '_impl'

like image 29
farhawa Avatar answered Sep 29 '22 09:09

farhawa