alibi_detect.models.tensorflow.autoencoder
AE
AEInherits from: Model, TensorFlowTrainer, Trainer, Layer, TFLayer, KerasAutoTrackable, AutoTrackable, Trackable, Operation, KerasSaveable
Constructor
AE(self, encoder_net: keras.src.models.model.Model, decoder_net: keras.src.models.model.Model, name: str = 'ae') -> Noneencoder_net
keras.src.models.model.Model
Layers for the encoder wrapped in a tf.keras.Sequential class.
decoder_net
keras.src.models.model.Model
Layers for the decoder wrapped in a tf.keras.Sequential class.
name
str
'ae'
Name of autoencoder model.
Methods
call
callcall(x: tensorflow.python.framework.tensor.Tensor) -> tensorflow.python.framework.tensor.Tensorx
tensorflow.python.framework.tensor.Tensor
Returns
Type:
tensorflow.python.framework.tensor.Tensor
AEGMM
AEGMMInherits from: Model, TensorFlowTrainer, Trainer, Layer, TFLayer, KerasAutoTrackable, AutoTrackable, Trackable, Operation, KerasSaveable
Constructor
AEGMM(self, encoder_net: keras.src.models.model.Model, decoder_net: keras.src.models.model.Model, gmm_density_net: keras.src.models.model.Model, n_gmm: int, recon_features: Callable = <function eucl_cosim_features at 0x280c66430>, name: str = 'aegmm') -> Noneencoder_net
keras.src.models.model.Model
Layers for the encoder wrapped in a tf.keras.Sequential class.
decoder_net
keras.src.models.model.Model
Layers for the decoder wrapped in a tf.keras.Sequential class.
gmm_density_net
keras.src.models.model.Model
Layers for the GMM network wrapped in a tf.keras.Sequential class.
n_gmm
int
Number of components in GMM.
recon_features
Callable
<function eucl_cosim_features at 0x280c66430>
Function to extract features from the reconstructed instance by the decoder.
name
str
'aegmm'
Name of the AEGMM model.
Methods
call
callcall(x: tensorflow.python.framework.tensor.Tensor) -> Tuple[tensorflow.python.framework.tensor.Tensor, tensorflow.python.framework.tensor.Tensor, tensorflow.python.framework.tensor.Tensor]x
tensorflow.python.framework.tensor.Tensor
Returns
Type:
Tuple[tensorflow.python.framework.tensor.Tensor, tensorflow.python.framework.tensor.Tensor, tensorflow.python.framework.tensor.Tensor]
Decoder
DecoderInherits from: Layer, TFLayer, KerasAutoTrackable, AutoTrackable, Trackable, Operation, KerasSaveable
Constructor
Decoder(self, decoder_net: keras.src.models.model.Model, name: str = 'decoder') -> Nonedecoder_net
keras.src.models.model.Model
Layers for the decoder wrapped in a tf.keras.Sequential class.
name
str
'decoder'
Name of decoder.
Methods
call
callcall(x: tensorflow.python.framework.tensor.Tensor) -> tensorflow.python.framework.tensor.Tensorx
tensorflow.python.framework.tensor.Tensor
Returns
Type:
tensorflow.python.framework.tensor.Tensor
DecoderLSTM
DecoderLSTMInherits from: Layer, TFLayer, KerasAutoTrackable, AutoTrackable, Trackable, Operation, KerasSaveable
Constructor
DecoderLSTM(self, latent_dim: int, output_dim: int, output_activation: str = None, name: str = 'decoder_lstm') -> Nonelatent_dim
int
Latent dimension.
output_dim
int
Decoder output dimension.
output_activation
Optional[str]
None
Activation used in the Dense output layer.
name
str
'decoder_lstm'
Name of decoder.
Methods
call
callcall(x: tensorflow.python.framework.tensor.Tensor, init_state: List[tensorflow.python.framework.tensor.Tensor]) -> Tuple[tensorflow.python.framework.tensor.Tensor, tensorflow.python.framework.tensor.Tensor, List[tensorflow.python.framework.tensor.Tensor]]x
tensorflow.python.framework.tensor.Tensor
init_state
List[tensorflow.python.framework.tensor.Tensor]
Returns
Type:
Tuple[tensorflow.python.framework.tensor.Tensor, tensorflow.python.framework.tensor.Tensor, List[tensorflow.python.framework.tensor.Tensor]]
EncoderAE
EncoderAEInherits from: Layer, TFLayer, KerasAutoTrackable, AutoTrackable, Trackable, Operation, KerasSaveable
Constructor
EncoderAE(self, encoder_net: keras.src.models.model.Model, name: str = 'encoder_ae') -> Noneencoder_net
keras.src.models.model.Model
Layers for the encoder wrapped in a tf.keras.Sequential class.
name
str
'encoder_ae'
Name of encoder.
Methods
call
callcall(x: tensorflow.python.framework.tensor.Tensor) -> tensorflow.python.framework.tensor.Tensorx
tensorflow.python.framework.tensor.Tensor
Returns
Type:
tensorflow.python.framework.tensor.Tensor
EncoderLSTM
EncoderLSTMInherits from: Layer, TFLayer, KerasAutoTrackable, AutoTrackable, Trackable, Operation, KerasSaveable
Constructor
EncoderLSTM(self, latent_dim: int, name: str = 'encoder_lstm') -> Nonelatent_dim
int
Latent dimension. Must be an even number given the bidirectional encoder.
name
str
'encoder_lstm'
Name of encoder.
Methods
call
callcall(x: tensorflow.python.framework.tensor.Tensor) -> Tuple[tensorflow.python.framework.tensor.Tensor, List[tensorflow.python.framework.tensor.Tensor]]x
tensorflow.python.framework.tensor.Tensor
Returns
Type:
Tuple[tensorflow.python.framework.tensor.Tensor, List[tensorflow.python.framework.tensor.Tensor]]
EncoderVAE
EncoderVAEInherits from: Layer, TFLayer, KerasAutoTrackable, AutoTrackable, Trackable, Operation, KerasSaveable
Constructor
EncoderVAE(self, encoder_net: keras.src.models.model.Model, latent_dim: int, name: str = 'encoder_vae') -> Noneencoder_net
keras.src.models.model.Model
Layers for the encoder wrapped in a tf.keras.Sequential class.
latent_dim
int
Dimensionality of the latent space.
name
str
'encoder_vae'
Name of encoder.
Methods
call
callcall(x: tensorflow.python.framework.tensor.Tensor) -> Tuple[tensorflow.python.framework.tensor.Tensor, tensorflow.python.framework.tensor.Tensor, tensorflow.python.framework.tensor.Tensor]x
tensorflow.python.framework.tensor.Tensor
Returns
Type:
Tuple[tensorflow.python.framework.tensor.Tensor, tensorflow.python.framework.tensor.Tensor, tensorflow.python.framework.tensor.Tensor]
Sampling
SamplingInherits from: Layer, TFLayer, KerasAutoTrackable, AutoTrackable, Trackable, Operation, KerasSaveable
Reparametrization trick. Uses (z_mean, z_log_var) to sample the latent vector z.
Methods
call
callcall(inputs: Tuple[tensorflow.python.framework.tensor.Tensor, tensorflow.python.framework.tensor.Tensor]) -> tensorflow.python.framework.tensor.TensorSample z.
inputs
Tuple[tensorflow.python.framework.tensor.Tensor, tensorflow.python.framework.tensor.Tensor]
Tuple with mean and log variance.
Returns
Type:
tensorflow.python.framework.tensor.Tensor
Seq2Seq
Seq2SeqInherits from: Model, TensorFlowTrainer, Trainer, Layer, TFLayer, KerasAutoTrackable, AutoTrackable, Trackable, Operation, KerasSaveable
Constructor
Seq2Seq(self, encoder_net: alibi_detect.models.tensorflow.autoencoder.EncoderLSTM, decoder_net: alibi_detect.models.tensorflow.autoencoder.DecoderLSTM, threshold_net: keras.src.models.model.Model, n_features: int, score_fn: Callable = <function squared_difference at 0x117cb00d0>, beta: float = 1.0, name: str = 'seq2seq') -> Noneencoder_net
alibi_detect.models.tensorflow.autoencoder.EncoderLSTM
Encoder network.
decoder_net
alibi_detect.models.tensorflow.autoencoder.DecoderLSTM
Decoder network.
threshold_net
keras.src.models.model.Model
Regression network used to estimate threshold.
n_features
int
Number of features.
score_fn
Callable
<function squared_difference at 0x117cb00d0>
Function used for outlier score.
beta
float
1.0
Weight on the threshold estimation loss term.
name
str
'seq2seq'
Name of the seq2seq model.
Methods
call
callcall(x: tensorflow.python.framework.tensor.Tensor) -> tensorflow.python.framework.tensor.TensorForward pass used for teacher-forcing training.
x
tensorflow.python.framework.tensor.Tensor
Returns
Type:
tensorflow.python.framework.tensor.Tensor
decode_seq
decode_seqdecode_seq(x: numpy.ndarray) -> Tuple[numpy.ndarray, numpy.ndarray]Sequence decoding and threshold estimation used for inference.
x
numpy.ndarray
Returns
Type:
Tuple[numpy.ndarray, numpy.ndarray]
VAE
VAEInherits from: Model, TensorFlowTrainer, Trainer, Layer, TFLayer, KerasAutoTrackable, AutoTrackable, Trackable, Operation, KerasSaveable
Constructor
VAE(self, encoder_net: keras.src.models.model.Model, decoder_net: keras.src.models.model.Model, latent_dim: int, beta: float = 1.0, name: str = 'vae') -> Noneencoder_net
keras.src.models.model.Model
Layers for the encoder wrapped in a tf.keras.Sequential class.
decoder_net
keras.src.models.model.Model
Layers for the decoder wrapped in a tf.keras.Sequential class.
latent_dim
int
Dimensionality of the latent space.
beta
float
1.0
Beta parameter for KL-divergence loss term.
name
str
'vae'
Name of VAE model.
Methods
call
callcall(x: tensorflow.python.framework.tensor.Tensor) -> tensorflow.python.framework.tensor.Tensorx
tensorflow.python.framework.tensor.Tensor
Returns
Type:
tensorflow.python.framework.tensor.Tensor
VAEGMM
VAEGMMInherits from: Model, TensorFlowTrainer, Trainer, Layer, TFLayer, KerasAutoTrackable, AutoTrackable, Trackable, Operation, KerasSaveable
Constructor
VAEGMM(self, encoder_net: keras.src.models.model.Model, decoder_net: keras.src.models.model.Model, gmm_density_net: keras.src.models.model.Model, n_gmm: int, latent_dim: int, recon_features: Callable = <function eucl_cosim_features at 0x280c66430>, beta: float = 1.0, name: str = 'vaegmm') -> Noneencoder_net
keras.src.models.model.Model
Layers for the encoder wrapped in a tf.keras.Sequential class.
decoder_net
keras.src.models.model.Model
Layers for the decoder wrapped in a tf.keras.Sequential class.
gmm_density_net
keras.src.models.model.Model
Layers for the GMM network wrapped in a tf.keras.Sequential class.
n_gmm
int
Number of components in GMM.
latent_dim
int
Dimensionality of the latent space.
recon_features
Callable
<function eucl_cosim_features at 0x280c66430>
Function to extract features from the reconstructed instance by the decoder.
beta
float
1.0
Beta parameter for KL-divergence loss term.
name
str
'vaegmm'
Name of the VAEGMM model.
Methods
call
callcall(x: tensorflow.python.framework.tensor.Tensor) -> Tuple[tensorflow.python.framework.tensor.Tensor, tensorflow.python.framework.tensor.Tensor, tensorflow.python.framework.tensor.Tensor]x
tensorflow.python.framework.tensor.Tensor
Returns
Type:
Tuple[tensorflow.python.framework.tensor.Tensor, tensorflow.python.framework.tensor.Tensor, tensorflow.python.framework.tensor.Tensor]
Functions
eucl_cosim_features
eucl_cosim_featureseucl_cosim_features(x: tensorflow.python.framework.tensor.Tensor, y: tensorflow.python.framework.tensor.Tensor, max_eucl: float = 100.0) -> tensorflow.python.framework.tensor.TensorCompute features extracted from the reconstructed instance using the
relative Euclidean distance and cosine similarity between 2 tensors.
x
tensorflow.python.framework.tensor.Tensor
Tensor used in feature computation.
y
tensorflow.python.framework.tensor.Tensor
Tensor used in feature computation.
max_eucl
float
100.0
Maximum value to clip relative Euclidean distance by.
Returns
Type:
tensorflow.python.framework.tensor.Tensor
Last updated
Was this helpful?

