28 lines
619 B
Python
28 lines
619 B
Python
import csv
|
|
import matplotlib.pyplot as plt
|
|
import pandas as pd
|
|
from tensorflow.keras.models import load_model
|
|
|
|
|
|
X_test = pd.read_csv('test.csv')
|
|
|
|
Y_test = X_test.pop('stabf')
|
|
Y_test = pd.get_dummies(Y_test)
|
|
|
|
model = load_model('grid-stability-dense.h5')
|
|
|
|
results = model.evaluate(X_test, Y_test, batch_size=64)
|
|
|
|
with open('eval.csv', 'a', newline='') as fp:
|
|
wr = csv.writer(fp, dialect='excel')
|
|
wr.writerow(results)
|
|
|
|
metrics = pd.read_csv('eval.csv', header=None, names=['loss', 'accuracy'])
|
|
|
|
fig = plt.figure()
|
|
plt.plot(metrics.accuracy)
|
|
plt.ylabel('Accuracy')
|
|
plt.xlabel('Build no.')
|
|
|
|
fig.savefig('plot.png')
|