OOD_AE#
- class dataeval.detectors.ood.OOD_AE(model: Module, device: str | device | None = None)#
Autoencoder based out-of-distribution detector.
- Parameters:
model (AriaAutoencoder) – An Autoencoder model.
- fit(x_ref: ArrayLike, threshold_perc: float, loss_fn: Callable[[...], Module] | None = None, optimizer: Optimizer | None = None, epochs: int = 20, batch_size: int = 64, verbose: bool = False) 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 scores 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 and feature-level OOD scores.
- Return type: