Skip to content

Commit

Permalink
Misc, minor updates (#28)
Browse files Browse the repository at this point in the history
* protection against missing distillation key in yml file

* move -f -r args before dir name

* Print path to stdout for the inclusive ROC
  • Loading branch information
bainbrid authored Mar 20, 2024
1 parent 9596275 commit ab158bd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions icenet/tools/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import torch
import gc
from pprint import pprint
from termcolor import colored, cprint
import copy

from tqdm import tqdm
Expand Down Expand Up @@ -1017,6 +1018,7 @@ def ROC_plot(metrics, labels, title = '', plot_thresholds=True, \

ax.set_aspect(1.0 / ax.get_data_ratio() * 1.0)
plt.savefig(filename + '.pdf', bbox_inches='tight')
cprint('Saved: ' + filename + '.pdf','green')

if k == 1: # Log-Linear

Expand Down
4 changes: 2 additions & 2 deletions icenet/tools/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ def train_models(data_trn, data_val, args=None) :


def set_distillation_drain(ID, param, inputs, dtype='torch'):
if args['distillation']['drains'] is not None:
if 'distillation' in args and args['distillation']['drains'] is not None:
if ID in args['distillation']['drains']:
cprint(__name__ + f'.train_models: Creating soft distillation drain for the model <{ID}>', 'yellow')

Expand Down Expand Up @@ -825,7 +825,7 @@ def set_distillation_drain(ID, param, inputs, dtype='torch'):

# --------------------------------------------------------
# If distillation
if ID == args['distillation']['source']:
if 'distillation' in args and ID == args['distillation']['source']:

if len(args['primary_classes']) != 2:
raise Exception(__name__ + f'.train_models: Distillation supported now only for 2-class classification')
Expand Down
2 changes: 1 addition & 1 deletion superclean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
echo "Cleaning output, figs, checkpoint and tmp folders completely (all results gone) -- Are you sure?"
select yn in "Yes" "No"; do
case $yn in
Yes ) rm output/* -f -r; rm figs/* -f -r; rm checkpoint/* -f -r; rm tmp/* -f -r; break;;
Yes ) rm -f -r output/*; rm -f -r figs/*; rm -f -r checkpoint/*; rm -f -r tmp/*; break;;
No ) break;;
esac
done

0 comments on commit ab158bd

Please sign in to comment.