OOD_VAEGMM#
- class dataeval.detectors.ood.OOD_VAEGMM(model: VAEGMM, samples: int = 10)#
VAE with Gaussian Mixture Model based outlier detector.
- Parameters:
model (VAEGMM) – A VAEGMM model.
samples – Number of samples sampled to evaluate each instance.
- fit(x_ref: ArrayLike, threshold_perc: float = 100.0, loss_fn: ~typing.Callable[[...], ~tensorflow.python.framework.tensor.Tensor] | None = None, optimizer: ~tf_keras.src.optimizers.optimizer.Optimizer = <class 'tf_keras.src.optimizers.adam.Adam'>, epochs: int = 20, batch_size: int = 64, verbose: bool = True) None#
Train the model and infer the threshold value.
- Parameters:
x_ref (ArrayLike) – Training data.
threshold_perc (float, default 100.0) – Percentage of reference data that is normal.
loss_fn (Callable | None, default None) – Loss function used for training.
optimizer (Optimizer, default keras.optimizers.Adam) – Optimizer used for training.
epochs (int, default 20) – Number of training epochs.
batch_size (int, default 64) – Batch size used for training.
verbose (bool, default True) – Whether to print training progress.
- predict(X: ArrayLike, batch_size: int = 10000000000, ood_type: Literal['feature', 'instance'] = 'instance') OODOutput#
Predict whether instances are out-of-distribution or not.
- Parameters:
X (ArrayLike) – Input data for out-of-distribution prediction.
batch_size (int, default 1e10) – Number of instances to process in each batch.
ood_type ("feature" | "instance", default "instance") – Predict out-of-distribution at the ‘feature’ or ‘instance’ level.
- Returns:
Dictionary containing the outlier predictions for the selected level,
and the OOD scores for the data including both ‘instance’ and ‘feature’ (if present) level scores.
- score(X: ArrayLike, batch_size: int = 10000000000) OODScoreOutput#
Compute the out-of-distribution (OOD) score for a given dataset.
- Parameters:
X (ArrayLike) – Input data to score.
batch_size (int, default 1e10) – Number of instances to process in each batch. Use a smaller batch size if your dataset is large or if you encounter memory issues.
- Returns:
An object containing the instance-level OOD score.
- Return type:
Note
This model does not produce a feature level score like the OOD_AE or OOD_VAE models.