Evidently and MLflow
Log Evidently metrics in the MLflow UI.
Last updated
Log Evidently metrics in the MLflow UI.
Last updated
TL;DR: You can use Evidently to calculate metrics, and MLflow Tracking to log and view the results. Here is a sample Jupyter notebook.
Many machine learning teams use MLflow for experiment management, deployment, and as a model registry. If you are already familiar with MLflow, you can integrate it with Evidently to track the performance of your models.
In this case, you use Evidently to calculate the metrics and MLflow to log the results. You can then access the metrics in the MLflow interface.
Evidently calculates a rich set of metrics and statistical tests. You can choose any of the pre-built reports to define the metrics you’d want to get.
You can then generate a JSON profile that will contain the defined metrics output. You can combine several profile sections (e.g., Data and Prediction Drift together).
You might not always need all metrics from the profile. You should explicitly define which parts of the output to send to MLflow Tracking.
In this example, we will use Evidently to check input features for Data Drift and log and visualize the results with MLflow.
Here is a Jupyter notebook with the example:
Evidently is available as a PyPI package:
For more details, refer to the Evidently installation guide.
To install MLflow, run:
Or install MLflow with scikit-learn via
For more details, refer to MLflow documentation.
Load the data from UCI repository (link) and save it locally.
For demonstration purposes, we treat this data as the input data for a live model. To use with production models, you should make your prediction logs available.
This is how it looks:
We specify the categorical and numerical features so that Evidently performs the correct statistical test for each of them.
We specify which metrics we want to see. In this case, we want to get the p-value of the statistical test performed to evaluate the drift for each feature.
We specify the period that is considered reference: we will use it as the base for the comparison. Then, we choose the periods that we treat as experiments that emulate production model runs.
We initiate the experiments and log the metrics calculated with Evidently on each run.
You can then use the MLflow UI to see the results of the runs.
With a large number of metrics, you can use the expanded view.
See a tutorial here.