alibi_detect.utils.tensorflow.misc module

alibi_detect.utils.tensorflow.misc.clone_model(model)[source]

Clone a sequential, functional or subclassed tf.keras.Model.

Return type:

Model

alibi_detect.utils.tensorflow.misc.quantile(sample, p, type=7, sorted=False)[source]

Estimate a desired quantile of a univariate distribution from a vector of samples

Parameters:
Return type:

float

Returns:

An estimate of the quantile

alibi_detect.utils.tensorflow.misc.subset_matrix(mat, inds_0, inds_1)[source]

Take a matrix and return the submatrix correspond to provided row and column indices

Parameters:
  • mat (Tensor) – A 2D matrix

  • inds_0 (Tensor) – A vector of row indices

  • inds_1 (Tensor) – A vector of column indices

Return type:

Tensor

Returns:

A submatrix of shape (len(inds_0), len(inds_1))

alibi_detect.utils.tensorflow.misc.zero_diag(mat)[source]

Set the diagonal of a matrix to 0

Parameters:

mat (Tensor) – A 2D square matrix

Return type:

Tensor

Returns:

A 2D square matrix with zeros along the diagonal