dataeval.detectors.drift.preprocess_drift#
- dataeval.detectors.drift.preprocess_drift(x, model, device=None, preprocess_batch_fn=None, batch_size=int(10000000000.0), dtype=np.float32)#
Prediction function used for preprocessing step of drift detector.
- Parameters:
x (NDArray) – Batch of instances.
model (nn.Module) – Model used for preprocessing.
device (torch.device | None, default None) – Device type used. The default None tries to use the GPU and falls back on CPU. Can be specified by passing either torch.device(‘cuda’) or torch.device(‘cpu’).
preprocess_batch_fn (Callable | None, default None) – Optional batch preprocessing function. For example to convert a list of objects to a batch which can be processed by the PyTorch model.
batch_size (int, default 1e10) – Batch size used during prediction.
dtype (np.dtype | torch.dtype, default np.float32) – Model output type, either a NumPy or torch dtype, e.g. np.float32 or torch.float32.
- Returns:
Numpy array, torch tensor or tuples of those with model outputs.
- Return type:
NDArray | torch.Tensor | tuple