WSAD-DT — Weakly Supervised Anomaly Detection via Dual-Tailed Kernel
Official implementation of the ICML 2025 paper "Weakly Supervised Anomaly Detection via Dual-Tailed Kernel" (Walid Durani, Tobias Nitzl, Claudia Plant, Christian Böhm).
WSAD-DT learns latent representations that separate anomalies from normal samples using only a handful of labeled anomalies. It introduces two centroids — one normal, one anomalous — and a dual-tailed kernel scheme: a light-tailed kernel compactly models in-class points while a heavy-tailed kernel maintains a wide margin against out-of-class instances; a kernel-based regularizer preserves intra-class diversity. An ensemble partitions the normal data across members (all members share the labeled anomalies), improving robustness.
Install
pip install wsad-dt
or from source:
git clone https://github.com/Walid10010/Weakly-Supervised-Anomaly-Detection-via-Dual-Tailed-Kernel.git
cd Weakly-Supervised-Anomaly-Detection-via-Dual-Tailed-Kernel
pip install -e .
Runtime dependencies: numpy, scikit-learn, torch (CPU is sufficient).
Quickstart
from wsad_dt import WSADDT
# y_weak: 1 for the few labeled anomalies, 0 for everything else
det = WSADDT(n_ensemble=5, seed=100).fit(X_train, y_weak)
scores = det.decision_function(X_test) # higher = more anomalous
labels = det.predict(X_test) # 1 = anomaly
Inputs should be scaled (the paper protocol uses MinMax to [0, 1]).
Key parameters: n_ensemble=5 (paper's num_splits), seed=100
(member j trains with seed seed * (j+1)), batch_size=64. The paper's
train(num_splits, X, y_semi, s) / test(...) entry points remain
importable from wsad_dt for script-level use.
Reproducing the paper
Experiments use the ADBench datasets and compare against DeepSAD, DevNet, RoSAS, PReNet, GANomaly, and XGBOD:
pip install -r requirements-experiments.txt
python experiments/run_exp.py
Protocol: MinMax scaling, stratified 70/30 splits (random_state ∈ {1, 5, 10}),
5% of anomalies labeled (minimum 5), ensemble of 5, AUC-ROC and AUC-PR
averaged over seeds and splits.
Implementation notes
The packaged model is verified equivalent to the original reference
script (tests/test_wsaddt.py::test_equivalent_to_legacy_reference),
with training running deterministically on CPU. Scoring convention follows
PyOD: higher decision_function values indicate anomalies
(score_samples gives the scikit-learn sign convention). See
IMPLEMENTATION_NOTES.md for documented reference
semantics.
Citation
@inproceedings{durani2025wsaddt,
title = {Weakly Supervised Anomaly Detection via Dual-Tailed Kernel},
author = {Durani, Walid and Nitzl, Tobias and Plant, Claudia and B{\"o}hm, Christian},
booktitle = {Proceedings of the 42nd International Conference on Machine Learning},
series = {Proceedings of Machine Learning Research},
volume = {267},
pages = {14833--14866},
publisher = {PMLR},
year = {2025}
}
License
Released under the MIT License.
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 wsad_dt-1.0.0.tar.gz.
File metadata
- Download URL: wsad_dt-1.0.0.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb10c9166bd39946b2746e4fa33ec5f1409e1dc9697f777af3092bade0a3bfe1
|
|
| MD5 |
ca03ad2a8ce942b5b429978602b1ff1c
|
|
| BLAKE2b-256 |
49c2518a7cc9dd0fb134beffd3b7c0f7b033baebf1ad29f9bb63461d82f7d468
|
File details
Details for the file wsad_dt-1.0.0-py3-none-any.whl.
File metadata
- Download URL: wsad_dt-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
235e72a63c1468575f3db94f6c97f67b1d086ca215c9be20e0ccb2098c3779b8
|
|
| MD5 |
07183b250856711571dcaf8e18bbc369
|
|
| BLAKE2b-256 |
4ac17e370f09f85c2076d943ceee569c5d0187152d2b1b569cced9bbd377af75
|