Issue
I run the code below:
from sklearn.metrics import precision_score
y_true = [0, 1, 2, 0, 1, 2]
y_pred = [0, 2, 1, 0, 0, 1]
metrics.precision_score(y_true, y_pred, average='macro')
and I get the error
AttributeError: 'list' object has no attribute 'precision_score'
What is wrong with my code?
Scikit-learn==0.23.2
Solution
Try :
precision_score(y_true, y_pred, average='macro')
Instead of
metrics.precision_score(y_true, y_pred, average='macro')
Maybe you created a variable metrics
some where before this code
Answered By - script0
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.