ksvmuralidhar commited on
Commit
684906e
·
verified ·
1 Parent(s): 77f4a7d

Update classification_model_monitor.py

Browse files
Files changed (1) hide show
  1. classification_model_monitor.py +7 -1
classification_model_monitor.py CHANGED
@@ -160,7 +160,13 @@ def get_misclassified_classes(data):
160
  misclassified_examples = data.loc[data['match'] == 0, ['text', 'y_true', 'y_pred', 'y_pred_proba', 'url']].copy()
161
  misclassified_examples.sort_values(by=['y_pred', 'y_pred_proba'], ascending=[True, False], inplace=True)
162
 
163
- misclassifications = data.loc[data['match'] == 0, 'y_pred'].value_counts()[y_pred_counts.index]
 
 
 
 
 
 
164
  misclassifications /= y_pred_counts
165
  misclassifications.sort_values(ascending=False, inplace=True)
166
  logging.info("Exiting get_misclassified_classes()")
 
160
  misclassified_examples = data.loc[data['match'] == 0, ['text', 'y_true', 'y_pred', 'y_pred_proba', 'url']].copy()
161
  misclassified_examples.sort_values(by=['y_pred', 'y_pred_proba'], ascending=[True, False], inplace=True)
162
 
163
+ misclassifications = data.loc[data['match'] == 0, 'y_pred'].value_counts()
164
+
165
+ missing_classes = [i for i in y_pred_counts.index if i not in misclassifications.index]
166
+ for i in missing_classes:
167
+ misclassifications[i] = 0
168
+
169
+ misclassifications = misclassifications[y_pred_counts.index].copy()
170
  misclassifications /= y_pred_counts
171
  misclassifications.sort_values(ascending=False, inplace=True)
172
  logging.info("Exiting get_misclassified_classes()")