Simple Hello World that demonstrates the different ways to run an MLflow experiment.
For details see MLflow documentation - Running Projects.
Synopsis of hello_world.py:
- Creates an experiment HelloWorld if it does not exist. You can optionally override with the standard MLFLOW_EXPERIMENT_NAME environment variable.
- Logs parameters, metrics and tags.
- No ML training.
- Optionally writes an artifact.
The different ways to run an experiment:
- Unmanaged without mlflow
- Command-line python
- Jupyter notebook
- Using mlflow run with MLproject
- mlflow run local
- mlflow run git
- mlflow run remote
External tracking server
export MLFLOW_TRACKING_URI=http://localhost:5000
Databricks managed tracking server
export MLFLOW_TRACKING_URI=databricks
The token and tracking server URL will be picked up from your Databricks CLI ~/.databrickscfg default profile.
python hello_world.py
See hello_world.ipynb.
export MLFLOW_TRACKING_URI=http://localhost:5000
jupyter notebook
mlflow run . -Palpha=.01 -Prun_origin=LocalRun -Plog_artifact=True
You can also specify an experiment ID:
mlflow run . --experiment-id=2019 -Palpha=.01 -Prun_origin=LocalRun -Plog_artifact=True
mlflow run https://github.com/amesar/mlflow-fun.git#examples/hello_world \
--experiment-id=2019 \
-Palpha=100 -Prun_origin=GitRun -Plog_artifact=True
Run against Databricks. See Remote Execution on Databricks and cluster.json.
mlflow run https://github.com/amesar/mlflow-fun.git#examples/hello_world \
--experiment-id=2019 \
-Palpha=100 -Prun_origin=RemoteRun -Plog_artifact=True \
-m databricks --cluster-spec cluster.json