To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 668405fc authored by Lukas Wolf's avatar Lukas Wolf
Browse files

debug plot

parent 433e6eec
......@@ -26,7 +26,7 @@ def plot_from_csv(file_path, output_dir, metric, savefig=True):
else:
plt.ylabel('Binary Cross Entropy Loss')
if savefig:
plt.savefig(output_dir + '/' + config['model'] + '_val_' + metric + '.png')
plt.savefig(output_dir + '/plots/' + config['model'] + '_val_' + metric + '.png')
def plot_array(x, output_dir, metric, savefig=True):
"""
......@@ -52,7 +52,7 @@ def plot_array(x, output_dir, metric, savefig=True):
else:
plt.ylabel('Binary Cross Entropy Loss')
if savefig:
plt.savefig(output_dir + '/' + config['model'] + '_val_' + metric + '.png')
plt.savefig(output_dir + '/plots' + config['model'] + '_val_' + metric + '.png')
def plot_metrics(train, val, output_dir, metric, model_number=0 ,savefig=True):
"""
......@@ -72,4 +72,4 @@ def plot_metrics(train, val, output_dir, metric, model_number=0 ,savefig=True):
plt.ylabel(metric)
if savefig:
plt.savefig(output_dir + '/' + config['model'] + '_' +str(model_number) + "_" + metric + '.png')
\ No newline at end of file
plt.savefig(output_dir + '/plots/' + config['model'] + '_' +str(model_number) + "_" + metric + '.png')
\ No newline at end of file
......@@ -40,8 +40,8 @@ def train_loop(dataloader, model, loss_fn, optimizer):
if config['task'] == 'prosaccade-clf':
accuracy = correct / size
logging.info(f"Avg training accuracy {accuracy:>8f}")
return loss.item(), accuracy.item()
return loss.item(), -1
return float(loss), float(accuracy)
return float(loss), -1
#@timing_decorator
@profile
......@@ -71,6 +71,6 @@ def validation_loop(dataloader, model, loss_fn):
if config['task'] == 'prosaccade-clf':
accuracy = correct / size
logging.info(f"Avg validation accuracy {accuracy:>8f}")
return loss.item(), accuracy.item()
return loss, -1 # Can be used for early stopping
return float(loss), float(accuracy)
return float(loss), -1 # Can be used for early stopping
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment