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:
sample (
Tensor
) – A 1D vector of valuesp (
float
) – The desired quantile in (0,1)type (
int
) – The method for computing the quantile. See https://wikipedia.org/wiki/Quantile#Estimating_quantiles_from_a_samplesorted (
bool
) – Whether or not the vector is already sorted into ascending order
- Return type:
- 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 matrixinds_0 (
Tensor
) – A vector of row indicesinds_1 (
Tensor
) – A vector of column indices
- Return type:
Tensor
- Returns:
A submatrix of shape (len(inds_0), len(inds_1))