Skip to content

Repository files navigation

spartan2

spartan2 is a toolkit of data mining algorithms for big graphs and time series, covering three core tasks:

  • Anomaly Detection — spot fraud, surges, and outliers
  • Forecasting — predict future patterns in time series
  • Summarization — compress and describe large graph/time-series structures

Docs: readthedocs | Tutorials: spartan2-tutorials


Why spartan2?

Graphs and time series appear across many domains — social networks, finance, sensor networks, and healthcare. Treating them as sparse tensors (matrices are 2-mode tensors) enables algorithms that are:

  • Efficient — near-linear complexity by exploiting sparsity
  • Interpretable — results backed by mathematical guarantees
  • Accurate — validated on real-world benchmarks

The name spartan = sparse tensor analytics.


Installation

Requires Python ≥ 3.7. We recommend using a Conda environment.

conda create -n spartan python=3.7
conda activate spartan

For users

pip install spartan2

For contributors / running from source

# 1. Clone the repo
git clone git@github.com:BGT-M/spartan2.git

# 2. Install dependencies
conda install --force-reinstall -y --name spartan -c conda-forge --file requirements

# 3. Install in editable mode
pip install -e spartan2
Setting PYTHONPATH (if needed)

Add to ~/.bashrc:

export PYTHONPATH=/<path-to>/spartan2:$PYTHONPATH

Or inside Python:

import sys
sys.path.append("/<path-to>/spartan2")

Quick Start

import spartan as st

# Load a graph as a sparse tensor
graph = st.loadGraph("your_edge_list.csv", col_types=[int, int, float])

# Run anomaly detection (e.g. HoloScope)
model = st.HoloScope(graph)
model.run()
model.result()

See the tutorials repo for runnable Jupyter notebooks for each algorithm.


Algorithms

Graph Mining

Algorithm Task Paper Year Tutorial
HoloScope Anomaly Detection [1] HoloScope: Topology-and-Spike Aware Fraud Detection [pdf] 2017 notebook
Eigenspokes Anomaly Detection [3] Eigenspokes: Surprising Patterns in Large Graphs [pdf] 2010 notebook
EagleMine Anomaly Detection [4] EagleMine: Vision-guided Micro-cluster Anomaly Detection [pdf] 2021 notebook
Fraudar Anomaly Detection [5] Fraudar: Bounding Graph Fraud in the Face of Camouflage [pdf] 2016 notebook
EigenPulse Anomaly Detection [7] EigenPulse: Detecting Surges in Large Streaming Graphs [pdf] 2019 notebook
FlowScope Anomaly Detection [8] FlowScope: Spotting Money Laundering Based on Graphs [pdf] 2020 notebook
CubeFlow Anomaly Detection [11] CubeFlow: Money Laundering Detection with Coupled Tensors [pdf] 2021 notebook
MonLAD Anomaly Detection [13] MonLAD: Money Laundering Agents Detection in Transaction Streams [pdf] 2022
SpecGreedy Anomaly Detection [12] SpecGreedy: Unified Dense Subgraph Detection [pdf] 2020 notebook
DPGS Summarization [6] DPGS: Degree-Preserving Graph Summarization [pdf] 2021 notebook
kGrass Summarization [9] GraSS: Graph Structure Summarization [pdf] 2010 notebook
IAT Summarization [10] RSC: Mining and Modeling Temporal Activity in Social Media [pdf] 2015 notebook

Time Series

Algorithm Task Paper Year Tutorial
BeatLex Summarization & Forecast [14] BEATLEX: Summarizing and Forecasting Time Series with Patterns [pdf] 2017 notebook
BeatGAN Anomaly Detection [15] BeatGAN: Anomalous Rhythm Detection using Adversarially Generated Time Series [pdf] 2019 notebook — requires torch and tqdm; uses scipy Pan-Tompkins (no biosppy)

References

  1. Shenghua Liu, Bryan Hooi, and Christos Faloutsos. "HoloScope: Topology-and-Spike Aware Fraud Detection." CIKM 2017.
  2. Shenghua Liu, Bryan Hooi, Christos Faloutsos. "A Contrast Metric for Fraud Detection in Rich Graphs." IEEE TKDE, Vol 31, Issue 12, 2019.
  3. B. Aditya Prakash et al. "Eigenspokes: Surprising Patterns and Scalable Community Chipping in Large Graphs." PAKDD 2010.
  4. Wenjie Feng, Shenghua Liu, et al. "EagleMine: Vision-guided Micro-clusters Recognition and Collective Anomaly Detection." Future Generation Computer Systems, 2021. Also: "Beyond Outliers and On to Micro-Clusters." PAKDD 2019.
  5. Bryan Hooi, Hyun Ah Song, et al. "Fraudar: Bounding Graph Fraud in the Face of Camouflage." KDD 2016.
  6. Houquan Zhou, Shenghua Liu, et al. "DPGS: Degree-Preserving Graph Summarization." SDM 2021.
  7. Jiabao Zhang, Shenghua Liu, et al. "EigenPulse: Detecting Surges in Large Streaming Graphs with Row Augmentation." PAKDD 2019.
  8. Xiangfeng Li, Shenghua Liu, et al. "FlowScope: Spotting Money Laundering Based on Graphs." AAAI 2020.
  9. Kristen LeFevre and Evimaria Terzi. "GraSS: Graph Structure Summarization." SDM 2010.
  10. Alceu Ferraz Costa et al. "RSC: Mining and Modeling Temporal Activity in Social Media." KDD 2015.
  11. Xiaobing Sun, Jiabao Zhang, et al. "CubeFlow: Money Laundering Detection with Coupled Tensors." PAKDD 2021.
  12. Wenjie Feng, Shenghua Liu, et al. "SpecGreedy: Unified Dense Subgraph Detection." ECML-PKDD 2020.
  13. Xiaobing Sun, Wenjie Feng, Shenghua Liu, et al. "MonLAD: Money Laundering Agents Detection in Transaction Streams." WSDM 2022.
  14. Bryan Hooi, Shenghua Liu, et al. "BEATLEX: Summarizing and Forecasting Time Series with Patterns." ECML-PKDD 2017.
  15. Bin Zhou, Shenghua Liu, et al. "BeatGAN: Anomalous Rhythm Detection using Adversarially Generated Time Series." IJCAI 2019.
  16. Shenghua Liu, Bin Zhou, et al. "Time Series Anomaly Detection with Adversarial Reconstruction Networks." IEEE TKDE 2022.

About

A collection of data mining algorithms on big graphs and time series

Topics

Resources

Stars

95 stars

Watchers

9 watching

Forks

Releases

Packages

Contributors

Languages