Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. def calc_accuracy(confusion_matrix1,class_num):
  2. print(confusion_matrix1)
  3. TP = confusion_matrix1[class_num,class_num]
  4. TN = 0.0
  5. Total = np.sum(confusion_matrix1)
  6. print(Total)
  7. # for line in confusion_matrix1:
  8. # for elem in line:
  9. # Total += elem
  10.  
  11. # aux_cm = np.delete(confusion_matrix1, class_num, 0)
  12.  
  13. # for line in aux_cm:
  14. # for elem in line:
  15. # TN += elem
  16. if(class_num==0):
  17. TN=confusion_matrix1[0,1]
  18. else:
  19. TN=confusion_matrix1[0,0]
  20.  
  21. print(TN)
  22. print(((TP + TN)/ Total)*100)
  23. return ((TP + TN)/ Total)*100
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement