Skip to content

Instantly share code, notes, and snippets.

@alexcpn
Created October 20, 2022 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexcpn/bb2992532b09fce4186f37165b954914 to your computer and use it in GitHub Desktop.
Save alexcpn/bb2992532b09fce4186f37165b954914 to your computer and use it in GitHub Desktop.
List out wrongly and irightly classified classes
#---------------------------------------------------------------------------------------------
# Populate the Confusion Matrix
#---------------------------------------------------------------------------------------------
for key,val in wrong_per_class.items(): # Key is category and val is a list of wrong classes
summed_wrong_classes =Counter(val).most_common()
print(f"**To Predict {categories[key]}")
for ele in summed_wrong_classes:
print(f" --Predicted {categories[ele[0]]} count={ele[1]}")
confusion_matrix[key][ele[0]]=ele[1]
for key,val in right_per_class.items(): # Key is category and val is a list of wrong classes
summed_right_classes =Counter(val).most_common()
print(f"**To Predict {categories[key]}")
for ele in summed_right_classes:
print(f" --Predicted {categories[ele[0]]} count={ele[1]}")
confusion_matrix[key][ele[0]]=ele[1]
print("Confusion Matrix2 =\n",confusion_matrix)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment