• +91 9723535972
  • info@interviewmaterial.com

Data Science Interview Questions and Answers

Question - Write code to calculate the accuracy of a binary classification algorithm using its confusion matrix.

Answer -

We can use the code given below to calculate the accuracy of a binary classification algorithm:

def accuracy_score(matrix):
  true_positives = matrix[0][0]
  true_negatives = matrix[1][1]
  total_observations = sum(matrix[0]) + sum(matrix[1])
  return (true_positives + true_negatives) / total_observations

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners