Plot
All checks were successful
s434784-evaluation/pipeline/head This commit looks good
s434784-training/pipeline/head This commit looks good

This commit is contained in:
Maciej Sobkowiak 2021-05-16 23:06:27 +02:00
parent 7c428075a4
commit 5189f40f7e

View File

@ -12,7 +12,6 @@ train = pd.read_csv('train.csv')
test = pd.read_csv('test.csv') test = pd.read_csv('test.csv')
validate = pd.read_csv('validate.csv') validate = pd.read_csv('validate.csv')
# # podział train set
X_train = train.loc[:, train.columns != 'suicides_no'] X_train = train.loc[:, train.columns != 'suicides_no']
y_train = train[['suicides_no']] y_train = train[['suicides_no']]
X_test = test.loc[:, train.columns != 'suicides_no'] X_test = test.loc[:, train.columns != 'suicides_no']
@ -36,3 +35,20 @@ error = mean_squared_error(y_test, predictions)
with open('results.txt', 'a') as f: with open('results.txt', 'a') as f:
f.write(str(error) + "\n") f.write(str(error) + "\n")
with open('results.txt', 'r') as f:
lines = f.readlines()
fig = plt.figure(figsize=(10, 5))
chart = fig.add_subplot()
chart.set_ylabel("Mean Squared Error")
chart.set_xlabel("Build number")
x = np.arange(0, len(lines), 1)
y = [float(val) for val in lines]
plt.plot(x, y, "bo")
plt.savefig("plot.png")