Skip to content

[TMLR 2026] Dealing with Uncertainty in Contextual Anomaly Detection

License

Notifications You must be signed in to change notification settings

lucabindini/NormalcyScore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NormalcyScore

Dealing with Uncertainty in Contextual Anomaly Detection [TMLR 2026]

Implementation of the normalcy score (NS) framework presented in Dealing with Uncertainty in Contextual Anomaly Detection.

NS is a contextual anomaly detection method that models both aleatoric and epistemic uncertainty via heteroscedastic Gaussian process regression (HGPR), returning:

  • an anomaly score (expected NS)
  • an uncertainty estimate through a 95% Highest Density Interval (HDI) on the score

Libraries Used

  • numpy, pandas, scipy
  • scikit-learn
  • tensorflow, gpflow
  • arviz (HDI computation)
  • pyod (optional baselines / utilities)
  • statsmodels, patsy (optional utilities)
  • rich (console logging)

Repository Structure

  • datasets/
    Put your CSV datasets here.

  • NS.py
    Implements the normalcy score: score definition and computation (and uncertainty-related outputs).

  • test_NS.py
    Runnable script to test NS on a dataset from datasets/ and save results.

  • ContextualAnomalyInject.py
    Utility to inject contextual anomalies and generate ground_truth.

The code structure and the anomaly injection script were implemented following the QCAD [DAMI 2023] implementation available here.

Citing the Paper

If you use this code, please cite:

@article{
bindini2026dealing,
title={Dealing with Uncertainty in Contextual Anomaly Detection},
author={Luca Bindini and Lorenzo Perini and Stefano Nistri and Jesse Davis and Paolo Frasconi},
journal={Transactions on Machine Learning Research},
issn={2835-8856},
year={2026},
url={https://openreview.net/forum?id=yLoXQDNwwa},
note={}
}

LICENSE

Creative Commons License
All material is available under Creative Commons BY-NC 4.0. You can use, redistribute, and adapt the material for non-commercial purposes, as long as you give appropriate credit by citing our paper and indicate any changes you've made.

About

[TMLR 2026] Dealing with Uncertainty in Contextual Anomaly Detection

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages