27 lines
702 B
Python
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")
|