0
0
MLOpsdevops~5 mins

Evidently AI for monitoring in MLOps - Commands & Configuration

Choose your learning style9 modes available
Introduction
When you build machine learning models, you want to make sure they keep working well over time. Evidently AI helps you watch your models and data to catch problems early, like if the data changes or the model starts making mistakes.
When you want to check if your model's predictions are still accurate after deployment.
When you need to detect if the input data to your model has changed unexpectedly.
When you want to generate easy-to-understand reports about your model's performance.
When you want to automate alerts if your model quality drops.
When you want to compare your model's current behavior to past behavior to spot issues.
Commands
This command installs the Evidently AI Python package so you can use it to monitor your models.
Terminal
pip install evidently
Expected OutputExpected
Collecting evidently Downloading evidently-0.2.38-py3-none-any.whl (123 kB) Installing collected packages: evidently Successfully installed evidently-0.2.38
This runs a Python script that loads your model and data, then uses Evidently to create a monitoring report.
Terminal
python monitor_model.py
Expected OutputExpected
Report saved to model_monitoring_report.html
Key Concept

If you remember nothing else from this pattern, remember: Evidently AI helps you automatically check your model's health by comparing current data and predictions to past behavior.

Code Example
MLOps
from evidently.dashboard import Dashboard
from evidently.dashboard.tabs import DataDriftTab, ClassificationPerformanceTab
import pandas as pd

# Load reference data (past data) and current data
reference_data = pd.read_csv('reference_data.csv')
current_data = pd.read_csv('current_data.csv')

# Create Evidently dashboard with data drift and performance tabs
dashboard = Dashboard(tabs=[DataDriftTab(), ClassificationPerformanceTab()])

# Calculate and save the report
dashboard.calculate(reference_data=reference_data, current_data=current_data)
dashboard.save('model_monitoring_report.html')
print('Report saved to model_monitoring_report.html')
OutputSuccess
Common Mistakes
Not installing the Evidently package before running the script
The script will fail because Evidently functions are not available without the package installed.
Always run 'pip install evidently' before using Evidently in your code.
Using Evidently without providing reference data for comparison
Evidently needs baseline data to detect changes; without it, monitoring reports will be incomplete or invalid.
Provide a clean reference dataset representing normal model behavior when creating reports.
Summary
Install Evidently AI Python package to enable model monitoring.
Use Evidently to compare current model data and predictions to reference data.
Generate easy-to-read reports that show data drift and model performance changes.