{"id":33253365,"url":"https://github.com/xuhongzuo/DeepOD","last_synced_at":"2025-11-21T18:02:52.753Z","repository":{"id":63061127,"uuid":"558766124","full_name":"xuhongzuo/DeepOD","owner":"xuhongzuo","description":"Deep learning-based outlier/anomaly detection","archived":false,"fork":false,"pushed_at":"2024-09-14T11:42:25.000Z","size":3701,"stargazers_count":530,"open_issues_count":11,"forks_count":61,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-07-23T21:44:43.967Z","etag":null,"topics":["anomaly-detection","deep-anomaly-detection","outlier-detection"],"latest_commit_sha":null,"homepage":"https://deepod.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xuhongzuo.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-28T08:45:59.000Z","updated_at":"2025-07-23T11:40:25.000Z","dependencies_parsed_at":"2023-02-18T06:01:17.300Z","dependency_job_id":"0895a3de-e2c2-4d8f-bf2d-70a4267f14f7","html_url":"https://github.com/xuhongzuo/DeepOD","commit_stats":{"total_commits":130,"total_committers":6,"mean_commits":"21.666666666666668","dds":"0.32307692307692304","last_synced_commit":"0eba65d912e869a16e5c88aff4a56db850602196"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/xuhongzuo/DeepOD","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuhongzuo%2FDeepOD","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuhongzuo%2FDeepOD/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuhongzuo%2FDeepOD/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuhongzuo%2FDeepOD/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xuhongzuo","download_url":"https://codeload.github.com/xuhongzuo/DeepOD/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuhongzuo%2FDeepOD/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285663972,"owners_count":27210638,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-21T02:00:06.175Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anomaly-detection","deep-anomaly-detection","outlier-detection"],"created_at":"2025-11-17T01:00:33.918Z","updated_at":"2025-11-21T18:02:52.732Z","avatar_url":"https://github.com/xuhongzuo.png","language":"Python","funding_links":[],"categories":["AI for *Ops","Outlier Detection","2024"],"sub_categories":["Observability \u0026 Monitoring with AI"],"readme":"Python Deep Outlier/Anomaly Detection (DeepOD)\n==================================================\n\n.. image:: https://github.com/xuhongzuo/DeepOD/actions/workflows/testing.yml/badge.svg\n   :target: https://github.com/xuhongzuo/DeepOD/actions/workflows/testing.yml\n   :alt: testing2\n\n.. image:: https://readthedocs.org/projects/deepod/badge/?version=latest\n    :target: https://deepod.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n\n.. image:: https://app.codacy.com/project/badge/Grade/2c587126aac2441abb917c032189fbe8\n    :target: https://app.codacy.com/gh/xuhongzuo/DeepOD/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade\n    :alt: codacy\n\n.. image:: https://coveralls.io/repos/github/xuhongzuo/DeepOD/badge.svg?branch=main\n    :target: https://coveralls.io/github/xuhongzuo/DeepOD?branch=main\n    :alt: coveralls\n\n.. image:: https://static.pepy.tech/personalized-badge/deepod?period=total\u0026units=international_system\u0026left_color=black\u0026right_color=orange\u0026left_text=Downloads\n   :target: https://pepy.tech/project/deepod\n   :alt: downloads\n\n.. image:: https://img.shields.io/badge/license-BSD2-blue\n   :alt: license\n\n\n   \n\n``DeepOD`` is an open-source python library for Deep Learning-based `Outlier Detection \u003chttps://en.wikipedia.org/wiki/Anomaly_detection\u003e`_\nand `Anomaly Detection \u003chttps://en.wikipedia.org/wiki/Anomaly_detection\u003e`_. ``DeepOD`` supports tabular anomaly detection and time-series anomaly detection.\n\n\nDeepOD includes **27** deep outlier detection / anomaly detection algorithms (in unsupervised/weakly-supervised paradigm).\nMore baseline algorithms will be included later.\n\n\n\n**DeepOD is featured for**:\n\n* **Unified APIs** across various algorithms.\n* **SOTA models** includes reconstruction-, representation-learning-, and self-superivsed-based latest deep learning methods.\n* **Comprehensive Testbed** that can be used to directly test different models on benchmark datasets (highly recommend for academic research).\n* **Versatile** in different data types including tabular and time-series data (DeepOD will support other data types like images, graph, log, trace, etc. in the future, welcome PR :telescope:).\n* **Diverse Network Structures** can be plugged into detection models, we now support LSTM, GRU, TCN, Conv, and Transformer for time-series data.  (welcome PR as well :sparkles:)\n\n\nIf you are interested in our project, we are pleased to have your stars and forks :thumbsup: :beers: .\n\n\nInstallation\n~~~~~~~~~~~~~~\nThe DeepOD framework can be installed via:\n\n\n.. code-block:: bash\n\n\n    pip install deepod\n\n\ninstall a developing version (strongly recommend)\n\n\n.. code-block:: bash\n\n\n    git clone https://github.com/xuhongzuo/DeepOD.git\n    cd DeepOD\n    pip install .\n\n\nUsages\n~~~~~~~~~~~~~~~~~\n\n\nDirectly use detection models in DeepOD:\n::::::::::::::::::::::::::::::::::::::::::\n\nDeepOD can be used in a few lines of code. This API style is the same with `Sklean \u003chttps://github.com/scikit-learn/scikit-learn\u003e`_ and `PyOD \u003chttps://github.com/yzhao062/pyod\u003e`_.\n\n\n**for tabular anomaly detection:**\n\n.. code-block:: python\n\n\n    # unsupervised methods\n    from deepod.models.tabular import DeepSVDD\n    clf = DeepSVDD()\n    clf.fit(X_train, y=None)\n    scores = clf.decision_function(X_test)\n\n    # weakly-supervised methods\n    from deepod.models.tabular import DevNet\n    clf = DevNet()\n    clf.fit(X_train, y=semi_y) # semi_y uses 1 for known anomalies, and 0 for unlabeled data\n    scores = clf.decision_function(X_test)\n\n    # evaluation of tabular anomaly detection\n    from deepod.metrics import tabular_metrics\n    auc, ap, f1 = tabular_metrics(y_test, scores)\n\n\n**for time series anomaly detection:**\n\n\n.. code-block:: python\n\n\n    # time series anomaly detection methods\n    from deepod.models.time_series import TimesNet\n    clf = TimesNet()\n    clf.fit(X_train)\n    scores = clf.decision_function(X_test)\n\n    # evaluation of time series anomaly detection\n    from deepod.metrics import ts_metrics\n    from deepod.metrics import point_adjustment # execute point adjustment for time series ad\n    eval_metrics = ts_metrics(labels, scores)\n    adj_eval_metrics = ts_metrics(labels, point_adjustment(labels, scores))\n    \n\n\n\n\nTestbed usage:\n::::::::::::::::::::::::::::::::::::::::::\n\n\nTestbed contains the whole process of testing an anomaly detection model, including data loading, preprocessing, anomaly detection, and evaluation. \n\nPlease refer to ``testbed/``\n\n* ``testbed/testbed_unsupervised_ad.py`` is for testing unsupervised tabular anomaly detection models.\n \n* ``testbed/testbed_unsupervised_tsad.py`` is for testing unsupervised time-series anomaly detection models.\n\n\nKey arguments:\n\n* ``--input_dir``: name of the folder that contains datasets (.csv, .npy)\n\n* ``--dataset``: \"FULL\" represents testing all the files within the folder, or a list of dataset names using commas to split them (e.g., \"10_cover*,20_letter*\")\n\n* ``--model``: anomaly detection model name\n\n* ``--runs``: how many times running the detection model, finally report an average performance with standard deviation values\n\n\nExample: \n\n1. Download `ADBench \u003chttps://github.com/Minqi824/ADBench/tree/main/adbench/datasets/\u003e`_ datasets.\n2. modify the ``dataset_root`` variable as the directory of the dataset.\n3. ``input_dir`` is the sub-folder name of the ``dataset_root``, e.g., ``Classical`` or ``NLP_by_BERT``.  \n4. use the following command in the bash\n\n\n.. code-block:: bash\n\n    \n    cd DeepOD\n    pip install .\n    cd testbed\n    python testbed_unsupervised_ad.py --model DeepIsolationForest --runs 5 --input_dir ADBench\n   \n\n\n\nImplemented Models\n~~~~~~~~~~~~~~~~~~~\n\n**Tabular Anomaly Detection models:**\n\n.. csv-table:: \n :header: \"Model\", \"Venue\", \"Year\", \"Type\", \"Title\"\n :widths: 4, 4, 4, 8, 20 \n\n Deep SVDD, ICML, 2018, unsupervised, Deep One-Class Classification  [#Ruff2018Deep]_\n REPEN, KDD, 2018, unsupervised, Learning Representations of Ultrahigh-dimensional Data for Random Distance-based Outlier Detection [#Pang2019Repen]_\n RDP, IJCAI, 2020, unsupervised, Unsupervised Representation Learning by Predicting Random Distances [#Wang2020RDP]_\n RCA, IJCAI, 2021, unsupervised, RCA: A Deep Collaborative Autoencoder Approach for Anomaly Detection [#Liu2021RCA]_\n GOAD, ICLR, 2020, unsupervised, Classification-Based Anomaly Detection for General Data [#Bergman2020GOAD]_\n NeuTraL, ICML, 2021, unsupervised, Neural Transformation Learning for Deep Anomaly Detection Beyond Images [#Qiu2021Neutral]_\n ICL, ICLR, 2022, unsupervised, Anomaly Detection for Tabular Data with Internal Contrastive Learning [#Shenkar2022ICL]_\n DIF, TKDE, 2023, unsupervised, Deep Isolation Forest for Anomaly Detection [#Xu2023DIF]_\n SLAD, ICML, 2023, unsupervised, Fascinating Supervisory Signals and Where to Find Them: Deep Anomaly Detection with Scale Learning [#Xu2023SLAD]_\n DevNet, KDD, 2019, weakly-supervised, Deep Anomaly Detection with Deviation Networks [#Pang2019DevNet]_\n PReNet, KDD, 2023, weakly-supervised, Deep Weakly-supervised Anomaly Detection [#Pang2023PreNet]_\n Deep SAD, ICLR, 2020, weakly-supervised, Deep Semi-Supervised Anomaly Detection [#Ruff2020DSAD]_\n FeaWAD, TNNLS, 2021, weakly-supervised, Feature Encoding with AutoEncoders for Weakly-supervised Anomaly Detection [#Zhou2021FeaWAD]_\n RoSAS, IP\u0026M, 2023, weakly-supervised, RoSAS: Deep semi-supervised anomaly detection with contamination-resilient continuous supervision [#Xu2023RoSAS]_\n\n**Time-series Anomaly Detection models:**\n\n.. csv-table:: \n :header: \"Model\", \"Venue\", \"Year\", \"Type\", \"Title\"\n :widths: 4, 4, 4, 8, 20 \n\n DCdetector, KDD, 2023, unsupervised, DCdetector: Dual Attention Contrastive Representation Learning for Time Series Anomaly Detection [#Yang2023dcdetector]_\n TimesNet, ICLR, 2023, unsupervised, TIMESNET: Temporal 2D-Variation Modeling for General Time Series Analysis [#Wu2023timesnet]_\n AnomalyTransformer, ICLR, 2022, unsupervised, Anomaly Transformer: Time Series Anomaly Detection with Association Discrepancy [#Xu2022transformer]_\n NCAD, IJCAI, 2022, unsupervised, Neural Contextual Anomaly Detection for Time Series [#Carmona2022NCAD]_\n TranAD, VLDB, 2022, unsupervised, TranAD: Deep Transformer Networks for Anomaly Detection in Multivariate Time Series Data [#Tuli2022TranAD]_\n COUTA, TKDE, 2024, unsupervised, Calibrated One-class Classification for Unsupervised Time Series Anomaly Detection [#Xu2024COUTA]_\n USAD, KDD, 2020, unsupervised, USAD: UnSupervised Anomaly Detection on Multivariate Time Series  \n DIF, TKDE, 2023, unsupervised, Deep Isolation Forest for Anomaly Detection [#Xu2023DIF]_\n TcnED, TNNLS, 2021, unsupervised, An Evaluation of Anomaly Detection and Diagnosis in Multivariate Time Series [#Garg2021Evaluation]_\n Deep SVDD (TS), ICML, 2018, unsupervised, Deep One-Class Classification [#Ruff2018Deep]_\n DevNet (TS), KDD, 2019, weakly-supervised, Deep Anomaly Detection with Deviation Networks [#Pang2019DevNet]_\n PReNet (TS), KDD, 2023, weakly-supervised, Deep Weakly-supervised Anomaly Detection [#Pang2023PreNet]_\n Deep SAD (TS), ICLR, 2020, weakly-supervised, Deep Semi-Supervised Anomaly Detection [#Ruff2020DSAD]_\n\nNOTE:\n\n- For Deep SVDD, DevNet, PReNet, and DeepSAD, we employ network structures that can handle time-series data. These models' classes have a parameter named  ``network`` in these models, by changing it, you can use different networks.   \n\n- We currently support 'TCN', 'GRU', 'LSTM', 'Transformer', 'ConvSeq', and 'DilatedConv'.   \n\n\nCitation\n~~~~~~~~~~~~~~~~~\nIf you use this library in your work, please cite these papers:\n\nXu, H., Pang, G., Wang, Y., \u0026 Wang, Y. (2023). Deep isolation forest for anomaly detection. IEEE Transactions on Knowledge and Data Engineering, 35(12), 12591-12604.\n\nXu, H., Wang, Y., Jian, S., Liao, Q., Wang, Y., \u0026 Pang, G. (2024). Calibrated one-class classification for unsupervised time series anomaly detection. IEEE Transactions on Knowledge and Data Engineering.\n\n\nYou can also use the BibTex entry below for citation.\n\n.. code-block:: bibtex\n\n   @ARTICLE{xu2023deep,\n      author={Xu, Hongzuo and Pang, Guansong and Wang, Yijie and Wang, Yongjun},\n      journal={IEEE Transactions on Knowledge and Data Engineering}, \n      title={Deep Isolation Forest for Anomaly Detection}, \n      year={2023},\n      volume={35},\n      number={12},\n      pages={12591--12604},\n      doi={10.1109/TKDE.2023.3270293}\n   }\n\n.. code-block:: bibtex\n\n   @ARTICLE{xu2024calibrated,\n      title={Calibrated one-class classification for unsupervised time series anomaly detection},\n      author={Xu, Hongzuo and Wang, Yijie and Jian, Songlei and Liao, Qing and Wang, Yongjun and Pang, Guansong},\n      journal={IEEE Transactions on Knowledge and Data Engineering},\n      year={2024},\n      publisher={IEEE}\n}\n\n\nStar History\n~~~~~~~~~~~~~~~~~\n\nCurrent stars:\n\n.. image:: https://img.shields.io/github/stars/xuhongzuo/deepod?labelColor=black\u0026color=red\n   :alt: GitHub Repo stars\n\n\n.. image:: https://api.star-history.com/svg?repos=xuhongzuo/DeepOD\u0026type=Date\n   :target: https://star-history.com/#xuhongzuo/DeepOD\u0026Date\n   :align: center\n\n\n\n\n\nReference\n~~~~~~~~~~~~~~~~~\n\n.. [#Ruff2018Deep] Ruff, Lukas, et al. \"Deep one-class classification.\" ICML. 2018.\n\n.. [#Pang2019Repen] Pang, Guansong, et al. \"Learning representations of ultrahigh-dimensional data for random distance-based outlier detection\". KDD (pp. 2041-2050). 2018.\n\n.. [#Wang2020RDP] Wang, Hu, et al. \"Unsupervised Representation Learning by Predicting Random Distances\". IJCAI (pp. 2950-2956). 2020.\n\n.. [#Liu2021RCA] Liu, Boyang, et al. \"RCA: A Deep Collaborative Autoencoder Approach for Anomaly Detection\". IJCAI (pp. 1505-1511). 2021.\n\n.. [#Bergman2020GOAD] Bergman, Liron, and Yedid Hoshen. \"Classification-Based Anomaly Detection for General Data\". ICLR. 2020.\n\n.. [#Qiu2021Neutral] Qiu, Chen, et al. \"Neural Transformation Learning for Deep Anomaly Detection Beyond Images\". ICML. 2021.\n\n.. [#Shenkar2022ICL] Shenkar, Tom, et al. \"Anomaly Detection for Tabular Data with Internal Contrastive Learning\". ICLR. 2022.\n\n.. [#Pang2019DevNet] Pang, Guansong, et al. \"Deep Anomaly Detection with Deviation Networks\". KDD. 2019.\n\n.. [#Pang2023PreNet] Pang, Guansong, et al. \"Deep Weakly-supervised Anomaly Detection\". KDD. 2023. \n\n.. [#Ruff2020DSAD] Ruff, Lukas, et al. \"Deep Semi-Supervised Anomaly Detection\". ICLR. 2020. \n\n.. [#Zhou2021FeaWAD] Zhou, Yingjie, et al. \"Feature Encoding with AutoEncoders for Weakly-supervised Anomaly Detection\". TNNLS. 2021. \n\n.. [#Xu2022transformer] Xu, Jiehui, et al. \"Anomaly Transformer: Time Series Anomaly Detection with Association Discrepancy\". ICLR, 2022.\n\n.. [#Wu2023timesnet] Wu, Haixu, et al. \"TimesNet: Temporal 2D-Variation Modeling for General Time Series Analysis\". ICLR. 2023.\n\n.. [#Yang2023dcdetector] Yang, Yiyuan, et al. \"DCdetector: Dual Attention Contrastive Representation Learning for Time Series Anomaly Detection\". KDD. 2023\n\n.. [#Tuli2022TranAD] Tuli, Shreshth, et al. \"TranAD: Deep Transformer Networks for Anomaly Detection in Multivariate Time Series Data\". VLDB. 2022.\n\n.. [#Carmona2022NCAD] Carmona, Chris U., et al. \"Neural Contextual Anomaly Detection for Time Series\". IJCAI. 2022. \n\n.. [#Garg2021Evaluation] Garg, Astha, et al. \"An Evaluation of Anomaly Detection and Diagnosis in Multivariate Time Series\". TNNLS. 2021. \n\n.. [#Xu2024COUTA] Xu, Hongzuo et al. \"Calibrated One-class Classification for Unsupervised Time Series Anomaly Detection\". TKDE. 2024.\n\n.. [#Xu2023DIF] Xu, Hongzuo et al. \"Deep Isolation Forest for Anomaly Detection\". TKDE. 2023.\n\n.. [#Xu2023SLAD] Xu, Hongzuo et al. \"Fascinating supervisory signals and where to find them: deep anomaly detection with scale learning\". ICML. 2023. \n\n.. [#Xu2023RoSAS] Xu, Hongzuo et al. \"RoSAS: Deep semi-supervised anomaly detection with contamination-resilient continuous supervision\". IP\u0026M. 2023. \n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuhongzuo%2FDeepOD","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxuhongzuo%2FDeepOD","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuhongzuo%2FDeepOD/lists"}