-
Notifications
You must be signed in to change notification settings - Fork 0
/
ml_flow_test.py
39 lines (29 loc) · 1.22 KB
/
ml_flow_test.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
#from mlflow.tracking import MlflowClient
#EXPERIMENT_NAME = "test_experiment"
#client = MlflowClient()
#try:
# experiment_id = client.create_experiment(EXPERIMENT_NAME)
#except BaseException:
# experiment_id = client.get_experiment_by_name(EXPERIMENT_NAME).experiment_id
#for model in ["linear", "Randomforest"]:
# run = client.create_run(experiment_id)
# client.log_metric(run.info.run_id, "rmse", 4.5)
# client.log_param(run.info.run_id, "model", model)
import mlflow
from mlflow.tracking import MlflowClient
EXPERIMENT_NAME = "test_experiment_scameronp"
# Indicate mlflow to log to remote server
mlflow.set_tracking_uri("https://mlflow.lewagon.ai/")
client = MlflowClient()
try:
experiment_id = client.create_experiment(EXPERIMENT_NAME)
except BaseException:
experiment_id = client.get_experiment_by_name(EXPERIMENT_NAME).experiment_id
yourname = 'scameronp'
if yourname is None:
print("please define your name, il will be used as a parameter to log")
for model in ["linear", "Randomforest"]:
run = client.create_run(experiment_id)
client.log_metric(run.info.run_id, "rmse", 4.5)
client.log_param(run.info.run_id, "model", model)
client.log_param(run.info.run_id, "student_name", yourname)