Title
Create new category
Edit page index title
Edit category
Edit link
Run MLflow in Local or Remote Mode
This page provides two example MLflow workflows using scikit-learn linear regression models in a JupyterHub Notebook environment—one runs locally with the MLflow UI, and the other logs experiments to a remote MLflow tracking server.
Scenario 1: Local MLflow Tracking and UI Launch
Set up your environment
Install the required Python packages, if not installed.
Run a complete MLflow workflow
Generate synthetic data using sklearn.datasets.make_regression.
Split the data into training and test sets.
Train a Linear Regression model using sklearn.linear_model.LinearRegression.
Log model parameters, metrics, and the model to the local MLflow tracking server.
Print the run ID and evaluation metrics for quick reference.
Launch the MLflow UI to explore logged runs:
Access the UI at http://localhost:5000 to view experiment results, compare runs, and manage artifacts.
Key Code Snippet
Notes
Local tracking data stored in
./mlruns.MLflow UI accessible at <MLflow_URL>.


Scenario 2: Remote MLflow Server with Custom Artifact Location
Set up your environment
Make sure MLflow and required dependencies are installed:
Run a remote MLflow workflow
Set the tracking URI to point to your remote MLflow server.
Create or use an existing experiment and define the artifact location (e.g., S3, NFS):
Train a Linear Regression model using
sklearn.linear_model.LinearRegression.Log parameters, metrics, and the model to the remote MLflow tracking server.
Print run details such as run ID and metrics for quick access.
This setup allows centralized tracking, easier collaboration, and persistent storage of experiments.
Key Code Snippet
Notes
Artifacts stored at the configured remote location.
Update the tracking URI and artifact location as needed.


Summary
These examples show how to:
Run MLflow Tracking and UI locally
Log experiments to a remote MLflow server with custom artifact storage
Train, evaluate, and log models to ensure reproducibility
Use these templates to seamlessly integrate MLflow into your machine learning projects for effective experiment tracking and model management.