Implementation of VAESIMCA one class classification method
Project description
VAESIMCA — one class classifier based on Variational Autoencoders and data driven SIMCA approach
The package vaesimca implements a method for creating one-class classification (OCC) models (also known as anomaly detectors or novelty detectors) using Variational Autoencoders (VAE). The overall idea is based on another OCC method, DD-SIMCA, and hence can be considered as a adaptation of the DD-SIMCA approach using VAE for data decomposition. The theoretical background and practical examples for the vaesimca methods are described in this paper, please use it for citation. The paper is freely available to everyone via open access option, it is recommended to read it first and then come back and try the examples from the demo notebook.
Although the method we proposed is versatile, the package implements VAESIMCA method for analysis of images. It can be installed from PyPI using pip or any other package manager compatible with PyPI, e.g.:
pip install vaesimca
It requires numpy, scipy, torch, torchvision, pandas, torch_lr_finder and matplotlib, which will be automatically installed as dependencies.
Getting started
Use Jupyter notebook demo.ipynb in order to get started. To run the examples from this notebook you need to download zip file with simulated dataset (it is also used for illustration of the method in the paper). Here is direct link to the archive with the dataset.
Simply download the dataset and unzip it to your working directory, where you have the notebook, and follow the guides. CSV files can be downloaded from GitHub as well.
Releases
1.0.0 (18/12/2025)
- fixed a bug leading to lack of reproducibility when
predict()is called several times. - when fitting a model, the loss value by default is now normalized to image size and batch size which makes it more stable and reproducible. If you want to use the previous way of computing loss, provide
loss_norm = Falseto the methodfit(). - method
gridsearch()can now be used with CSV based data. - method
plotDistance()shows objects in the same order as they were loaded without regrouping them. - method
plotError()now also works with object index (e.g. show error for object12). - method
stat()returns two outcomes instead of one: the number of accepted/rejected objects for each class (like in previous version) and the figures of merits (TN, FN, TP, FP, sensitivity, specificity and efficiency). - method
gridsearch()also returns two data frames, one with all class based details like in previous version and second one with figures of merits. - method
summary()now also shows figures of merits (sensitivity, specificity and efficiency). - added memory and CUDA device cache cleaning after each grid search iteration to avoid memory leaks.
- several smaller improvements and bug fixes.
- see updated demo.ipynb for all details.
0.4.2 (2/6/2025)
- added possibility to load data from CSV files.
- added learning rate finder option.
0.3.7
- fixed a bug in saving state dictionary of the best model during training loop.
Reference
A. Petersen, S. Kucheryavskiy, VAE-SIMCA — Data-driven method for building one class classifiers with variational autoencoders, Chemometrics and Intelligent Laboratory Systems, 256, 2025, 105276, DOI: 10.1016/j.chemolab.2024.105276.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vaesimca-1.0.0.tar.gz.
File metadata
- Download URL: vaesimca-1.0.0.tar.gz
- Upload date:
- Size: 51.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1cb6133a5757cb380c3b415161abc2384dc41bdfec97db4ded3aca49256c0dd
|
|
| MD5 |
0e338fe1be832d3c8835b23494067a97
|
|
| BLAKE2b-256 |
54db0ad904c1957074b487fe7bba2668c41cfd23fd6491a45c82d579c20f3a9b
|
File details
Details for the file vaesimca-1.0.0-py3-none-any.whl.
File metadata
- Download URL: vaesimca-1.0.0-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b6ba56f5dd07a228269108cfe24fd77068163a00cb9f468c983ea343c06e120
|
|
| MD5 |
d908f37a0110a91cd066c5d6562a2fc4
|
|
| BLAKE2b-256 |
c399a327dac4eeb483cdc6f0c4eb1c3f7e8234caeeeef0d3048ad890ab05fa2e
|