plot
All checks were successful
s444354-training/pipeline/head This commit looks good
s444354-evaluation/pipeline/head This commit looks good

This commit is contained in:
Adrian Charkiewicz 2022-05-07 05:17:49 +02:00
parent c785c6d147
commit 72f5852d1a

View File

@ -3,7 +3,7 @@ import re
from sklearn import metrics from sklearn import metrics
import numpy as np import numpy as np
import csv import csv
import matplotlib.pyplot as plt
f = open("result.txt", "r") f = open("result.txt", "r")
list_result, list_predicted=[],[] list_result, list_predicted=[],[]
@ -27,3 +27,21 @@ print("RMSE: ",metrics[2])
with open('eval.csv', 'a', newline='') as f: with open('eval.csv', 'a', newline='') as f:
writer = csv.writer(f) writer = csv.writer(f)
writer.writerow((metrics[0],metrics[1], metrics[2])) writer.writerow((metrics[0],metrics[1], metrics[2]))
MAE,MSE,RMSE=[],[],[]
with open('eval.csv', 'r') as r:
for row in r:
# row variable is a list that represents a row in csv
row=row.split(',')
MAE.append(float(row[0]))
MSE.append(float(row[1]))
RMSE.append(float(row[2]))
plt.ylabel('F score')
plt.plot(np.arange(0, len(MAE)), MAE)
plt.plot(np.arange(0, len(MSE)), MSE)
plt.plot(np.arange(0, len(RMSE)), RMSE)
plt.savefig('metrics.png')