Browse by type
C++ implementation of
The old implementation is in another branch OldImplementation, it should be considered as being archived and will hardly receive feature updates.

If you use Windows:
cd to the project root MIDAS/cmake -DCMAKE_BUILD_TYPE=Release -GNinja -S . -B build/releasecmake --build build/release --target Democd to MIDAS/build/release/.\Demo.exeIf you use Linux/macOS:
cd to the project root MIDAS/cmake -DCMAKE_BUILD_TYPE=Release -S . -B build/releasecmake --build build/release --target Democd to MIDAS/build/release/./DemoThe demo runs on MIDAS/data/DARPA/darpa_processed.csv, which has 4.5M records, with the filtering core (MIDAS-F).
The scores will be exported to MIDAS/temp/Score.txt, higher means more anomalous.
All file paths are absolute and "hardcoded" by CMake, but it's suggested NOT to run by double clicking on the executable file.
Core - C++11 - C++ standard libraries
Demo
- Python 3 (MIDAS/util/EvaluateScore.py)
- pandas: I/O
- scikit-learn: Compute ROC-AUC
Experiment - (Optional) Intel TBB: Parallelization - (Optional) OpenMP: Parallelization
Other python utility scripts
- Python 3
- pandas
- scikit-learn
Cores are instantiated at MIDAS/example/Demo.cpp:67-69, uncomment the chosen one.
Demo.cppYou need to prepare three files:
N, the number of records in the datasetpathMetaMIDAS/data/DARPA/darpa_shape.txt[N,3]pathDataMIDAS/data/DARPA/darpa_processed.csv[N,1]pathGroundTruthMIDAS/data/DARPA/darpa_ground_truth.csvMIDAS/src/NormalCore.hpp, MIDAS/src/RelationalCore.hpp or MIDAS/src/FilteringCore.hppoperator() on individual data records, it returns the anomaly score for the input recordexample/Experiment.cppThe code we used for experiments.
It will try to use Intel TBB or OpenMP for parallelization.
You should comment all but only one runner function call in the main() as most results are exported to MIDAS/temp/Experiiment.csv together with many intermediate files.
Reproducible.cppSimilar to Demo.cpp, but with all random parameters hardcoded and always produce the same result.
It's for other developers and us to test if the implementation in other languages can produce acceptable results.
util/DeleteTempFile.py, EvaluateScore.py and ReproduceROC.py will show their usage and a short description when executed without any argument.
PreprocessData.pyThe code to process the raw dataset into an easy-to-read format.
Datasets are always assumed to be in a folder in MIDAS/data/.
It can process the following dataset(s)
DARPA/darpa_original.csv -> DARPA/darpa_processed.csv, DARPA/darpa_ground_truth.csv, DARPA/darpa_shape.txtIf you use this code for your research, please consider citing our arXiv preprint
@misc{bhatia2020realtime,
title={Real-Time Streaming Anomaly Detection in Dynamic Graphs},
author={Siddharth Bhatia and Rui Liu and Bryan Hooi and Minji Yoon and Kijung Shin and Christos Faloutsos},
year={2020},
eprint={2009.08452},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
or our AAAI paper
@inproceedings{bhatia2020midas,
title="MIDAS: Microcluster-Based Detector of Anomalies in Edge Streams",
author="Siddharth {Bhatia} and Bryan {Hooi} and Minji {Yoon} and Kijung {Shin} and Christos {Faloutsos}",
booktitle="AAAI 2020 : The Thirty-Fourth AAAI Conference on Artificial Intelligence",
year="2020"
}
$ claude mcp add MIDAS \
-- python -m otcore.mcp_server <graph>