Create a random forest model and log the model, model parameters, evaluation metrics, and other artifacts using mlflow.log_param()
, mlflow.log_metric()
, mlflow.log_model()
, and mlflow.log_artifact()
. These functions let you control exactly which parameters and metrics are logged, and also let you log other artifacts of the run such as tables and plots.
To view the results, click the Experiments icon in the right sidebar. This sidebar displays the parameters and metrics for each run of this notebook.
Click the name of the run to open the Runs page in a new tab. This page shows all of the information that was logged from the run. Select the Artifacts tab to find the logged model and plot.
For more information, see "MLflow experiments" (AWS|Azure|GCP).
MLflow logging API example (Python)
This notebook illustrates how to use the MLflow logging API to start an MLflow run and log the model, model parameters, evaluation metrics, and other run artifacts to the run. The easiest way to get started using MLflow tracking with Python is to use the MLflow
autolog()
API. If you need more control over the metrics logged for each training run, or want to log additional artifacts such as tables or plots, you can use themlflow.log_metric()
andmlflow.log_artifact()
APIs demonstrated in this notebook.Setup
This notebook creates a Random Forest model on a simple dataset and uses the MLflow Tracking API to log the model and selected model parameters and metrics.