Skip to content

Instantly share code, notes, and snippets.

@tbenst
Last active December 5, 2019 03:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbenst/e793704190322915e9641c64351322a2 to your computer and use it in GitHub Desktop.
Save tbenst/e793704190322915e9641c64351322a2 to your computer and use it in GitHub Desktop.
mlflow example
import os
from mlflow import log_metric, log_param, log_artifact
import mlflow
mlflow.set_tracking_uri("http://localhost:5000")
mlflow.set_experiment("my-experiment")
if __name__ == "__main__":
# Log a parameter (key-value pair)
log_param("param1", 5)
# Log a metric; metrics can be updated throughout the run
log_metric("foo", 1)
log_metric("foo", 2)
log_metric("foo", 3)
# Log an artifact (output file)
with open("output.txt", "w") as f:
f.write("Hello world!")
log_artifact("output.txt")
#!/usr/bin/env bash
mlflow server > log 2>&1 &
sleep 5
python mlflow_tracking.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment