This commit is contained in:
Jakub Zaręba 2023-05-10 19:07:41 +02:00
parent bdaba18487
commit 5e19ff3ce8

View File

@ -8,7 +8,6 @@ import os
model = tf.keras.models.load_model('model.h5')
test_data = pd.read_csv('data.csv', sep=';')
test_data = pd.get_dummies(test_data, columns=['Sex', 'Medal'])
test_data = test_data.drop(columns=['Name', 'Team', 'NOC', 'Games', 'Year', 'Season', 'City', 'Sport', 'Event'])
@ -33,11 +32,12 @@ if os.path.exists(metrics_file):
metrics_df = pd.read_csv(metrics_file)
else:
metrics_df = pd.DataFrame(columns=['top_1_accuracy', 'top_5_accuracy'])
metrics_df = metrics_df.concat({'top_1_accuracy': np.mean(top_1_accuracy), 'top_5_accuracy': np.mean(top_5_accuracy)}, ignore_index=True)
new_row = pd.DataFrame({'top_1_accuracy': np.mean(top_1_accuracy), 'top_5_accuracy': np.mean(top_5_accuracy)}, index=[0])
metrics_df = pd.concat([metrics_df, new_row], ignore_index=True)
metrics_df.to_csv(metrics_file, index=False)
plt.figure(figsize=(10, 6))
plt.plot(metrics_df['top_1_accuracy'], label='Top-1 Accuracy')
plt.plot(metrics_df['top_5_accuracy'], label='Top-5 Accuracy')
plt.legend()
plt.savefig('plot.png')
plt.savefig('plot.png')