-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccuracy.py
28 lines (21 loc) · 1.08 KB
/
accuracy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from utilities.data_management import load_vector, open_w_pandas, make_path, make_dir, check_existence
from utilities.plotting import plot_training_statistics, show, confusion_matrix
from config import dataset
abuse_keys = ['val_accuracy', 'val_loss']
intent_keys = ['accuracy', 'loss']
base = make_path('data/processed_data') / dataset / 'analysis'
abuse_path = base / 'abuse' / 'training_history.csv'
intent_path = base / 'intent' / 'deep_history.csv'
figure_base = make_path('figures') / dataset / 'analysis'
check_existence([intent_path, abuse_path])
make_dir(figure_base)
print('Config complete.')
abuse = open_w_pandas(abuse_path)
intent = open_w_pandas(intent_path)
print('Loaded data.')
accuracy, loss = abuse[abuse_keys].values.transpose()
plot_training_statistics(accuracy, loss, 'Abuse training statistics', figure_base / 'abuse_training.png')
accuracy, loss = intent[intent_keys].values.transpose()
plot_training_statistics(accuracy, loss, 'Intent training statistics', figure_base / 'intent_training.png')
print('Finished plotting and saving figures.')
show()