Files
mlflow-docker-minio/quickstart/mlflow_tracking.py

23 lines
628 B
Python
Raw Normal View History

2018-11-22 21:14:20 +08:00
import os
from random import random, randint
import mlflow
2018-11-22 21:14:20 +08:00
if __name__ == "__main__":
2020-08-23 14:48:38 +02:00
with mlflow.start_run() as run:
mlflow.set_tracking_uri('http://localhost:5000')
print("Running mlflow_tracking.py")
2018-11-22 21:14:20 +08:00
mlflow.log_param("param1", randint(0, 100))
2020-08-23 14:48:38 +02:00
mlflow.log_metric("foo", random())
mlflow.log_metric("foo", random() + 1)
mlflow.log_metric("foo", random() + 2)
2018-11-22 21:14:20 +08:00
2020-08-23 14:48:38 +02:00
if not os.path.exists("outputs"):
os.makedirs("outputs")
with open("outputs/test.txt", "w") as f:
f.write("hello world!")
2018-11-22 21:14:20 +08:00
mlflow.log_artifacts("outputs")