DriftDetectorPipelineElement#

class capymoa.stream.preprocessing.DriftDetectorPipelineElement[source]#

Bases: PipelineElement

Pipeline element that wraps around a drift detector

__init__(
drift_detector: BaseDriftDetector,
prepare_drift_detector_input_func: Callable,
)[source]#

Initializes the pipeline element with a drift detector.

Parameters#

drift_detector: BaseDriftDetector

The drift detector that associated with the pipeline element

prepare_drift_detector_input_func: Callable

The function that prepares the input of the drift detector. The function signature should start with the instance and the prediction. E.g., prediction_is_correct(instance, pred). The output of that function gets passed to the drift detector

pass_forward(
instance: Instance,
) Instance[source]#

Simply returns the instance. The drift detector gets updated in pass_forward_predict.

Parameters#

instance: Instance

The instance

Returns#

Instance

The instance that was provided as input

pass_forward_predict(
instance: Instance,
prediction: Any = None,
) Tuple[Instance, Any][source]#

Updates the drift detector; returns the instance and the prediction that were provided to the function

Parameters#

instance: Instance:

The instance

prediction: Any

The prediction from the previous pipeline steps. This can be None (e.g., when monitoring the the instance), an integer (e.g., when monitoring a classifier), or a float (when monitoring a regressor). It can also be anything else, but it must be compatible with prepare_drift_detector_input_func

Returns#

Tuple[Instance, Any]

The instance and prediction that were provided as input