ium_470607/lab5/eval.py

24 lines
483 B
Python
Raw Normal View History

2021-05-02 22:01:32 +02:00
import pandas as pd
import numpy as np
import tensorflow as tf
def onezero(label):
return 0 if label == 'unstable' else 1
X_test = pd.read_csv('test.csv')
Y_test = X_test.pop('stabf')
Y_test_one_zero = [onezero(x) for x in Y_test]
Y_test_onehot = np.eye(2)[Y_test_one_zero]
model = tf.keras.models.load_model('grid_stability.h5')
results = model.evaluate(X_test, Y_test_onehot, batch_size=64)
f = open('eval.csv', 'a+')
f.write(results[0], ',')
f.write(results[1], ',')