-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2Evaluate.py
More file actions
49 lines (33 loc) · 1.26 KB
/
2Evaluate.py
File metadata and controls
49 lines (33 loc) · 1.26 KB
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
41
42
43
44
45
46
47
48
49
import os
from azureml.core.authentication import ServicePrincipalAuthentication
from azureml.core import Workspace
import AML
aml = AML.AML()
ws = aml.ws
print("Found workspace {} at location {}".format(ws.name, ws.location))
from azureml.core import Experiment
experiment = Experiment(workspace=ws, name="diabetes-experiment")
minimum_rmse_runid = None
minimum_rmse = None
for run in experiment.get_runs():
run_metrics = run.get_metrics()
run_details = run.get_details()
# each logged metric becomes a key in this returned dict
run_rmse = run_metrics["rmse"]
run_id = run_details["runId"]
if minimum_rmse is None:
minimum_rmse = run_rmse
minimum_rmse_runid = run_id
else:
if run_rmse < minimum_rmse:
minimum_rmse = run_rmse
minimum_rmse_runid = run_id
print("Best run_id: " + minimum_rmse_runid)
print("Best run_id rmse: " + str(minimum_rmse))
from azureml.core import Run
best_run = Run(experiment=experiment, run_id=minimum_rmse_runid)
print(best_run.get_file_names())
best_run.download_file(name="model_alpha_0.1.pkl")
model = best_run.register_model(model_name='diabetes',
model_path='model_alpha_0.1.pkl')
print(model.name, model.id, model.version, sep='\t')