0
$\begingroup$

I am getting the following result for the confusion matrix and accuracy for a logistic
regression model.

array([[26,  0,  0],
       [ 1, 24,  0],
       [ 0,  0, 24]])
Accuracy: 1.0


Is this a correct result? As a 1 in the second row indicates that the actual
value was different from the predicted one. But that means accuracy can't be 1.0.
But still python returned the accuracy as 1.0

The code used to calculate this is :

from sklearn.metrics import accuracy_score 
accuracy_score(y_true=y_train, y_pred=classifier.predict(X_train))
$\endgroup$

1 Answer 1

1
$\begingroup$

Looks like your accuracy is rounded to one decimal:

acc = (26 + 24 + 24) / (1 + 26 + 24 + 24)

results in 0.9866666666666667 but

np.round(acc, 1)

gives 1.0.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.