Commit 1c6212c1 authored by okiss's avatar okiss
Browse files

Update utils.py

parent 600d8dc3
......@@ -33,15 +33,30 @@ def plot_loss(hist,name,val=False):
plt.plot(epochs,hist.history['val_loss'],'g-',label='validation')
plt.legend()
plt.xlabel('epochs')
plt.ylabel('Binary Cross Entropie')
plt.ylabel('Binary Cross Entropy')
plt.savefig('loss_'+name+'.png')
plt.show()
def plot_loss_torch(loss,name='CNN'):
epochs=np.arange(len(loss))
plt.figure()
plt.title(name+ ' loss')
plt.plot(epochs,loss,'b-',label='training')
plt.legend()
plt.xlabel('epochs')
plt.ylabel('Binary Cross Entropy')
plt.savefig('loss_'+name+'.png')
plt.show()
# Save the logs (newly added without debugging)
# haven't write about the pytorch=True part
def save_logs(hist, output_directory=config['model_dir'], pytorch=False):
if pytorch:
pass
df_metrics={'Loss':hist}
df_metrics=pd.DataFrame(df_metrics)
df_metrics.to_csv(output_directory + config['model'] + '_df_metrics.csv', index=False)
else:
hist_df = pd.DataFrame(hist.history)
......
Supports Markdown
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