# `DriftDetectorPipelineElement`

### *class* capymoa.stream.preprocessing.DriftDetectorPipelineElement[[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/stream/preprocessing/pipeline.py#L265)

Bases: [`PipelineElement`](capymoa.stream.preprocessing.PipelineElement.md#capymoa.stream.preprocessing.PipelineElement)

Pipeline element that wraps around a drift detector

#### \_\_init_\_(drift_detector: [BaseDriftDetector](capymoa.drift.base_detector.BaseDriftDetector.md#capymoa.drift.base_detector.BaseDriftDetector), prepare_drift_detector_input_func: [Callable](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable))[[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/stream/preprocessing/pipeline.py#L270)

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

#### get_input_schema() → [Schema](capymoa.stream.Schema.md#capymoa.stream.Schema) | [None](https://docs.python.org/3/builtins/constants.html#None)[[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/stream/preprocessing/pipeline.py#L48)

Return the schema of instances this element expects to receive.

Defaults to [`get_schema()`](#capymoa.stream.preprocessing.DriftDetectorPipelineElement.get_schema), which is correct for every element that
does not alter the attribute set.

#### get_schema() → [Schema](capymoa.stream.Schema.md#capymoa.stream.Schema) | [None](https://docs.python.org/3/builtins/constants.html#None)[[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/stream/preprocessing/pipeline.py#L39)

Return the schema of instances leaving this element.

Returns `None` when the element neither knows nor alters the schema –
a drift detector, for instance. The default is `None` so that existing
[`PipelineElement`](capymoa.stream.preprocessing.PipelineElement.md#capymoa.stream.preprocessing.PipelineElement) implementations keep working unchanged.

#### pass_forward(instance: [Instance](capymoa.core.Instance.md#capymoa.core.Instance)) → [Instance](capymoa.core.Instance.md#capymoa.core.Instance)[[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/stream/preprocessing/pipeline.py#L292)

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](capymoa.core.Instance.md#capymoa.core.Instance), prediction: [Any](https://docs.python.org/3/library/typing.html#typing.Any) = None) → [tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[Instance](capymoa.core.Instance.md#capymoa.core.Instance), [Any](https://docs.python.org/3/library/typing.html#typing.Any)][[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/stream/preprocessing/pipeline.py#L310)

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
