ium_434784/evaluation.py
Maciej Sobkowiak 584f623294
Some checks failed
s434784-evaluation/pipeline/head There was a failure building this commit
s434784-training/pipeline/head This commit looks good
Added evaluation
2021-05-16 21:19:00 +02:00

27 lines
702 B
Python

import pandas as pd
import numpy as np
from tensorflow import keras
import matplotlib.pyplot as plt
from keras import backend as K
from sklearn.metrics import mean_squared_error
model = 'suicide_model.h5'
model = keras.models.load_model(model)
train = pd.read_csv('train.csv')
test = pd.read_csv('test.csv')
validate = pd.read_csv('validate.csv')
# podział train set
X_train = train.loc[:, train.columns != 'suicides_no']
y_train = train[['suicides_no']]
X_test = test.loc[:, train.columns != 'suicides_no']
y_test = test[['suicides_no']]
predictions = model.predict(X_test)
error = mean_squared_error(y_test, predictions)
with open('eval_results.txt', 'a') as f:
f.write(str(error) + "\n")