Skip to content

Commit

Permalink
Fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rajpurkar committed Jan 18, 2017
1 parent 6139b7e commit 2be11f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions ecg/eval-keras.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
y_val_flat = np.argmax(y_val, axis=-1).flatten().tolist()
predictions_flat = np.argmax(predictions, axis=-1).flatten().tolist()

print(classification_report(
y_val_flat, predictions_flat,
target_names=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])

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])
print(classification_report(
y_val_flat, predictions_flat,
target_names=dl.classes))

print(tabulate(cnf_matrix, headers=[c[:1] for c in dl.classes]))
2 changes: 1 addition & 1 deletion ecg/train-keras.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def get_folder_name(start_time, net_type):

def get_filename_for_saving(start_time, net_type):
saved_filename = get_folder_name(start_time, net_type) + \
"/{val_loss:.3f}-{val_acc.3f}-{epoch:002d}-{loss.3f}-{acc.3f}.hdf5"
"/{val_loss:.3f}-{val_acc:.3f}-{epoch:002d}-{loss:.3f}-{acc:.3f}.hdf5"
return saved_filename


Expand Down

0 comments on commit 2be11f6

Please sign in to comment.