Skip to content

Instantly share code, notes, and snippets.

@StevenSong
Last active September 8, 2020 13:59
Show Gist options
  • Save StevenSong/0316112bf123c1843e94435c6788728e to your computer and use it in GitHub Desktop.
Save StevenSong/0316112bf123c1843e94435c6788728e to your computer and use it in GitHub Desktop.
#!/bin/bash
# Log files are stored in subdirectories of current directly: ./*/log*
# Log files contain output like: ROC AUC * {label} * = 0.NNN
# Where the AUC for a label on the test set is the last ocurrence of the above fragment in the file
#
# For example, in an experiment to predict "death", our results are in a
# folder "experiment" with 10 subfolders "trial_N", where N is the trial number.
# Within each "trial_N" subfolder, there is a file "log" with output lines:
#
# ROC AUC death = 0.NNN
#
# We run "auc" in the "experiment" folder.
# If our models predict more than one label, use "auc death".
for file in */log*
do
tac "$file" | grep -m 1 -hoE "ROC AUC.*$1.*= 0.[0-9]{3}" | grep -hoE "0.[0-9]{3}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment