Generate profiles
How to generate JSON profiles in Evidently.
After installation, import evidently and the required profiles sections:
import pandas as pd
from sklearn import datasets
from evidently.model_profile import Profile
from evidently.model_profile.sections import DataDriftProfileSection
Sections in Profiles work just like Tabs in Dashboards. You can choose among:
DataDriftProfileSection to estimate the data drift,
NumTargetDriftProfileSection to estimate target drift for numerical target,
CatTargetDriftProfileSectionto estimate target drift for categorical target,
ClassificationPerformanceProfileSection to explore the performance of a classification model,
ProbClassificationPerformanceProfileSection to explore the performance of a probabilistic classification model,
RegressionPerformanceProfileSection to explore the performance of a regression model.
Create a pandas.DataFrame with the dataset to analyze:
iris = datasets.load_iris()
iris_frame = pd.DataFrame(iris.data, columns = iris.feature_names)
Generate and view the output as a JSON profile.
data_drift_profile = Profile(sections=[DataDriftProfileSection()])
data_drift_profile.calculate(reference_data, recent_data,
column_mapping=column_mapping)
data_drift_profile.json()
To generate the Data Drift profile, run:
To generate the Data Drift and the Categorical Target Drift profile, run:
You can also generate a Regression Model Performance for a single DataFrame. In this case, run:
To generate the Classification Model Performance profile, run:
For Probabilistic Classification Model Performance profile, run:
You can also generate either of the Classification profiles for a single DataFrame. In this case, run:
or