Skip to content
Advertisement

AttributeError: ‘numpy.ndarray’ object has no attribute ‘score’ error

I have tried to look for a problem but there is nothing Im seeing wrong here. What could it be? This is for trying binary classification in SVM for the fashion MNIST data set but only classifying 5 and 7.

JavaScript

Advertisement

Answer

ypred is an array of predicted class labels, so the exception makes sense.

What you should do is use the classifier’s score method:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement