-
Notifications
You must be signed in to change notification settings - Fork 1
/
results_analysis_6.py
40 lines (32 loc) · 1.3 KB
/
results_analysis_6.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
29
30
31
32
33
34
35
36
37
38
39
40
from mlflow.tracking.client import MlflowClient
import mlflow
import numpy as np
start_experiment=3
end_experiment=9
metric='val_accuracy'
num_epochs=50
experiment_ids=[1,2,3,4,5,6]
means=[]
stds=[]
for experiment_id in experiment_ids:
experiment_id = str(experiment_id)
experiment_name = mlflow.get_experiment(experiment_id).name
print(experiment_name)
results = mlflow.search_runs(experiment_ids=[experiment_id])
max_accuracies=[]
for run_id in (results['run_id']):
val_accuracies=MlflowClient().get_metric_history(run_id, metric)
max_accuracy=0.
for epoch in range(num_epochs):
accuracy=val_accuracies[epoch].value
if val_accuracies[epoch].value > max_accuracy:
max_accuracy=val_accuracies[epoch].value
max_accuracies.append(max_accuracy)
mean=np.mean(max_accuracies)
std=np.std(max_accuracies)
print('Mean:{} Std:{}'.format(mean, std))
means.append(mean)
stds.append(std)
#just use format
print("& 50 & ${:.3f}\pm{:.3f}$ & ${:.3f}\pm{:.3f}$ & ${:.3f}\pm{:.3f}${} \n & & & 100 & ${:.3f}\pm{:.3f}$ & ${:.3f}\pm{:.3f}$ & ${:.3f}\pm{:.3f}${}".format(means[0], stds[0], means[2], stds[2], means[4], stds[4],r"\\", means[1], stds[1], means[3], stds[3], means[5], stds[5], r" \\"))
#60 mean, 60 std, 100 mean, 100 std, 150 mean, 150 std, 60 mean, 60 std, 100 mean, 100 std, 150 mean, 150 std