ium_407409/model_test.py
Grzegorz Gapiński 391b74a662 Task for Lab 5
One file for training model, second one to test it
2023-05-12 22:42:27 +02:00

15 lines
455 B
Python

import pandas as pd
import tensorflow as tf
df = pd.read_csv('data_test.csv')
df.drop(['zwyciezca'], axis=1, inplace=True)
model = tf.keras.models.load_model('model_election.h5')
predictions = model.predict(df).flatten()
output = pd.DataFrame({'predicted': predictions})
output.loc[output['predicted'] <= 0.5, 'predicted'] = 0
output.loc[output['predicted'] > 0.5, 'predicted'] = 1
output.to_csv('election_predictions.csv', index=False)