So, in our example,
TP = 4
TN = 4
FP = 1
FN = 1
So, the accuracy score is:
How to calculate the accuracy score using the sklearn Python library?
We can use the following Python code to calculate the accuracy score of a machine learning model.
from sklearn.metrics import accuracy_score
Ya = [False, False, True, True, True, False, True, False, False, True]
Y = [True, False, True, True, False, False, True, False, False, True]
accuracy = accuracy_score(Ya, Y)
print("Accuracy Score: \n", accuracy)
Here, Ya is the actual or expected output. And Y is the calculated output. The output of the above program will be:
Accuracy Score: 0.8








































0 Comments