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.
Metadata
Release files for wsad-dt 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wsad_dt-1.0.0.tar.gz | 11.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wsad_dt-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.0 kB
Release files / wsad_dt-1.0.0.tar.gz
| Download URL | wsad_dt-1.0.0.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bb10c9166bd39946b2746e4fa33ec5f1409e1dc9697f777af3092bade0a3bfe1
|
|
BLAKE2b-256 checksum How to use checksums |
49c2518a7cc9dd0fb134beffd3b7c0f7b033baebf1ad29f9bb63461d82f7d468
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.13
|
Release files / wsad_dt-1.0.0-py3-none-any.whl
| Download URL | wsad_dt-1.0.0-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
235e72a63c1468575f3db94f6c97f67b1d086ca215c9be20e0ccb2098c3779b8
|
|
BLAKE2b-256 checksum How to use checksums |
4ac17e370f09f85c2076d943ceee569c5d0187152d2b1b569cced9bbd377af75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.13
|