alibi_detect.cd.tensorflow package

class alibi_detect.cd.tensorflow.HiddenOutput(model, layer=-1, input_shape=None, flatten=False)[source]

Bases: tensorflow.keras.Model

call(x)[source]
Return type

Tensor

class alibi_detect.cd.tensorflow.UAE(encoder_net=None, input_layer=None, shape=None, enc_dim=None)[source]

Bases: tensorflow.keras.Model

call(x)[source]
Return type

Tensor

alibi_detect.cd.tensorflow.preprocess_drift(x, model, preprocess_batch_fn=None, tokenizer=None, max_len=None, batch_size=10000000000, dtype=numpy.float32)[source]

Prediction function used for preprocessing step of drift detector.

Parameters
  • x (Union[ndarray, list]) – Batch of instances.

  • model (Model) – Model used for preprocessing.

  • preprocess_batch_fn (Optional[Callable]) – Optional batch preprocessing function. For example to convert a list of objects to a batch which can be processed by the TensorFlow model.

  • tokenizer (Optional[Callable]) – Optional tokenizer for text drift.

  • max_len (Optional[int]) – Optional max token length for text drift.

  • batch_size (int) – Batch size.

  • dtype (dtype) – Model output type, e.g. np.float32 or tf.float32.

Return type

Union[ndarray, Tensor]

Returns

Numpy array with predictions.