alibi_detect.utils.tensorflow.misc
Functions
clone_model
clone_modelclone_model(model: keras.src.models.model.Model) -> keras.src.models.model.ModelClone a sequential, functional or subclassed tf.keras.Model.
model
keras.src.models.model.Model
Returns
Type:
keras.src.models.model.Model
quantile
quantilequantile(sample: tensorflow.python.framework.tensor.Tensor, p: float, type: int = 7, sorted: bool = False) -> floatEstimate a desired quantile of a univariate distribution from a vector of samples
sample
tensorflow.python.framework.tensor.Tensor
A 1D vector of values
p
float
The desired quantile in (0,1)
type
int
7
The method for computing the quantile. See https://wikipedia.org/wiki/Quantile#Estimating_quantiles_from_a_sample
sorted
bool
False
Whether or not the vector is already sorted into ascending order
Returns
Type:
float
subset_matrix
subset_matrixsubset_matrix(mat: tensorflow.python.framework.tensor.Tensor, inds_0: tensorflow.python.framework.tensor.Tensor, inds_1: tensorflow.python.framework.tensor.Tensor) -> tensorflow.python.framework.tensor.TensorTake a matrix and return the submatrix correspond to provided row and column indices
mat
tensorflow.python.framework.tensor.Tensor
A 2D matrix
inds_0
tensorflow.python.framework.tensor.Tensor
A vector of row indices
inds_1
tensorflow.python.framework.tensor.Tensor
A vector of column indices
Returns
Type:
tensorflow.python.framework.tensor.Tensor
zero_diag
zero_diagzero_diag(mat: tensorflow.python.framework.tensor.Tensor) -> tensorflow.python.framework.tensor.TensorSet the diagonal of a matrix to 0
mat
tensorflow.python.framework.tensor.Tensor
A 2D square matrix
Returns
Type:
tensorflow.python.framework.tensor.Tensor
Last updated
Was this helpful?

