r": "#c292a1",

"reference_data_color": "#017b92",),

],

),

You can view the complete list of configuration parameters in the SDK docs.

The Evidently Data Validator

The Evidently Data Validator implements the same interface as do all Data Validators, so this method forces you to maintain some level of compatibility with the overall Data Validator abstraction, which guarantees an easier migration in case you decide to switch to another Data Validator.

All you have to do is call the Evidently Data Validator methods when you need to interact with Evidently to generate data reports or to run test suites, e.g.:

from typing_extensions import Annotated  # or `from typing import Annotated on Python 3.9+

from typing import Tuple

import pandas as pd

from evidently.pipeline.column_mapping import ColumnMapping

from zenml.integrations.evidently.data_validators import EvidentlyDataValidator

from zenml.integrations.evidently.metrics import EvidentlyMetricConfig

from zenml.integrations.evidently.tests import EvidentlyTestConfig

from zenml.types import HTMLString

from zenml import step

@step

def data_profiling(

reference_dataset: pd.DataFrame,

comparison_dataset: pd.DataFrame,

) -> Tuple[

Annotated[str, "report_json"],

Annotated[HTMLString, "report_html"]

]:

"""Custom data profiling step with Evidently.

Args:

reference_dataset: a Pandas DataFrame

comparison_dataset: a Pandas DataFrame of new data you wish to

compare against the reference data

Returns:

The Evidently report rendered in JSON and HTML formats.

"""

# pre-processing (e.g. dataset preparation) can take place here

data_validator = EvidentlyDataValidator.get_active_data_validator()

report = data_validator.data_profiling(

dataset=reference_dataset,

comparison_dataset=comparison_dataset,

profile_list=[

EvidentlyMetricConfig.metric("DataQualityPreset"),

EvidentlyMetricConfig.metric(

"TextOverviewPreset", column_name="Review_Text"

),

EvidentlyMetricConfig.metric_generator(

"ColumnRegExpMetric",

columns=["Review_Text", "Title"],