headers in csv updated
All checks were successful
s444507-evaluation/pipeline/head This commit looks good
444507-training/pipeline/head This commit looks good

This commit is contained in:
Adam Wojdyla 2022-05-02 01:33:14 +02:00
parent bddb6ea50c
commit a790cff9b0

View File

@ -10,6 +10,7 @@ from sklearn.metrics import accuracy_score, f1_score
from csv import DictWriter
import torch.nn.functional as F
import sys
import os
class Model(nn.Module):
def __init__(self, input_dim):
@ -52,9 +53,13 @@ def print_metrics(test_labels, predictions):
print(f"Build number: {build_number}")
field_names = ['BUILD_NUMBER', 'F1', 'ACCURACY']
dict = {'BUILD_NUMBER': build_number, 'F1': f1, 'ACCURACY': accuracy }
filename = "./metrics.csv"
file_exists = os.path.isfile(filename)
with open('metrics.csv', 'a') as metrics_file:
with open(filename, 'a') as metrics_file:
dictwriter_object = DictWriter(metrics_file, fieldnames=field_names)
if not file_exists:
dictwriter_object.writeheader()
dictwriter_object.writerow(dict)
metrics_file.close()
except Exception as e: