Add a custom drift method
How to implement a new drift detection method.
Pre-requisites:
You know how to set custom drift methods and which methods are available in the library.
If you do not find a suitable drift detection method, you can implement a custom function.
Code example
Notebook example with custom data drift function example:
Custom StatTest function requirements:
The StatTest function should match (reference_data: pd.Series, current_data: pd.Series, threshold: float) -> Tuple[float, bool]
signature:
reference_data: pd.Series
- reference data seriescurrent_data: pd.Series
- current data series to comparefeature_type: str
- feature typethreshold: float
- Stat Test threshold for drift detection
Returns:
score: float
- Stat Test score (actual value)drift_detected: bool
- indicates is drift detected with given threshold
Example:
StatTest meta information (StatTest class):
To use the StatTest function, we recommended writing a specific instance of the StatTest class for that function:
To create the instance of the StatTest
class, you need:
name: str
- a short name used to reference the Stat Test from the options (the StatTest should be registered globally)display_name: str
- a long name displayed in the Dashboard and Profilefunc: Callable
- a StatTest functionallowed_feature_types: List[str]
- the list of allowed feature types to which this function can be applied (available values:cat
,num
)
Example:
Last updated