Metadata-Version: 2.5
Name: graphspot
Version: 0.1.0a1
Summary: Inductive graph anomaly detection with honest baselines. Scores nodes and edges it has never seen, installs without torch.
Project-URL: Repository, https://github.com/JayeshSuryavanshi/graphspot
Author-email: Jayesh Suryavanshi <jayeshsuryavanshi808@gmail.com>
License: BSD-3-Clause
License-File: LICENSE
Keywords: anomaly-detection,fraud-detection,graph,outlier-detection
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: <3.14,>=3.10
Requires-Dist: numpy>=1.24
Requires-Dist: pandas>=2.0
Requires-Dist: scikit-learn>=1.3
Requires-Dist: scipy>=1.10
Requires-Dist: xgboost>=2.0
Provides-Extra: deep
Requires-Dist: torch-geometric>=2.5; extra == 'deep'
Requires-Dist: torch>=2.2; extra == 'deep'
Description-Content-Type: text/markdown

# graphspot

Graph anomaly detection for people who have to score things they have never seen before.

- **Inductive by contract.** Every detector's `decision_function` scores nodes absent at fit
  time. Never `NotImplementedError`.
- **Installs without torch.** The core is numpy/scipy/sklearn/pandas/xgboost. Deep detectors
  live behind `pip install graphspot[deep]`.
- **Honest baselines.** Every evaluation can include a no-graph tabular baseline, and graphspot
  warns loudly when the graph model fails to beat it.

Status: pre-release, under active development. The v0 detector set is
`NeighborAggregation` (transform), `XGBGraph`, `RFGraph`, `FlatBaseline`, with
`FlatUnsupervised`, `OddBall`, `Fraudar` and `BWGNN` (behind `[deep]`) on the way.

```python
import graphspot
from graphspot.detectors import XGBGraph, FlatBaseline
from graphspot.datasets import load_yelpchi

g = load_yelpchi()

det = XGBGraph(random_state=0).fit(g, y=g.node_labels)
flat = FlatBaseline(random_state=0).fit(g, y=g.node_labels)

print(graphspot.evaluate(
    g.node_labels,
    det.decision_scores_,
    baseline_scores=flat.decision_scores_,
))

det.explain(k=5)   # e.g. [("2hop_mean(f21)", 0.14), ("1hop_max(f3)", 0.11), ...]
```

Works directly on transaction dataframes:

```python
g = graphspot.Graph.from_pandas(
    tx, source="buyer_id", target="seller_id",
    edge_features=["amount"], time="ts",
    node_features=accounts.set_index("account_id"),
)
```

License: BSD-3-Clause.
