Compare commits

..

2 Commits

Author SHA1 Message Date
Jakub Zaręba
1ee4b4103d l 2023-05-10 19:33:20 +02:00
Jakub Zaręba
5e19ff3ce8 s 2023-05-10 19:07:41 +02:00

View File

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