Skip to content

Commit

Permalink
Handle 0 examples error only when neccessary
Browse files Browse the repository at this point in the history
  • Loading branch information
rajpurkar committed Jan 17, 2017
1 parent cb61d85 commit 0a90aa8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ecg/eval-keras.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@
predictions = np.load(open(args.prediction_path, 'rb'))

y_val_flat = np.argmax(y_val, axis=-1).flatten().tolist()
y_val_flat.extend(range(len(dl.classes)))
predictions_flat = np.argmax(predictions, axis=-1).flatten().tolist()
predictions_flat.extend(range(len(dl.classes)))

print(classification_report(
y_val_flat, predictions_flat,
target_names=dl.classes))

y_val_flat.extend(range(len(dl.classes)))
predictions_flat.extend(range(len(dl.classes)))

cnf_matrix = confusion_matrix(y_val_flat, predictions_flat).tolist()
for i, row in enumerate(cnf_matrix):
row.insert(0, dl.classes[i])
Expand Down

0 comments on commit 0a90aa8

Please sign in to comment.