Metadata-Version: 2.4
Name: federated-graph
Version: 0.1.0
Summary: Federated Graph Intelligence SDK for financial fraud detection
Project-URL: Repository, https://github.com/Adeyeha/federated_graph
Project-URL: Issues, https://github.com/Adeyeha/federated_graph/issues
Author-email: Temitope Adeyeha <temitope.adeyeha@yahoo.com>
License-Expression: MIT
License-File: LICENSE
Keywords: federated-learning,fraud-detection,gnn,graph-neural-network,privacy
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Security
Requires-Python: >=3.10
Requires-Dist: cryptography>=41.0
Requires-Dist: numpy>=1.24
Requires-Dist: pydantic>=2.0
Requires-Dist: structlog>=23.0
Requires-Dist: torch-geometric>=2.4
Requires-Dist: torch>=2.1
Provides-Extra: all
Requires-Dist: grpcio-tools>=1.60; extra == 'all'
Requires-Dist: grpcio>=1.60; extra == 'all'
Requires-Dist: mypy; extra == 'all'
Requires-Dist: protobuf>=4.25; extra == 'all'
Requires-Dist: pytest-asyncio; extra == 'all'
Requires-Dist: pytest-cov; extra == 'all'
Requires-Dist: pytest>=7.4; extra == 'all'
Requires-Dist: redis>=5.0; extra == 'all'
Requires-Dist: ruff; extra == 'all'
Requires-Dist: scikit-learn>=1.3; extra == 'all'
Provides-Extra: dev
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest>=7.4; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Provides-Extra: grpc
Requires-Dist: grpcio-tools>=1.60; extra == 'grpc'
Requires-Dist: grpcio>=1.60; extra == 'grpc'
Requires-Dist: protobuf>=4.25; extra == 'grpc'
Provides-Extra: redis
Requires-Dist: redis>=5.0; extra == 'redis'
Provides-Extra: scoring
Requires-Dist: scikit-learn>=1.3; extra == 'scoring'
Description-Content-Type: text/markdown

# Federated Graph

A privacy-preserving Graph Neural Network framework for financial fraud detection using federated learning. Federated Graph enables organizations to collaboratively train fraud detection models on their transaction graphs without sharing raw data.

## Features

- **Federated Learning** — Train models collaboratively across multiple clients with privacy-preserving aggregation
- **Temporal Graph Neural Networks** — Capture temporal dynamics in transaction networks with decay-aware convolutions
- **Dual-Head Risk Scoring** — Entity-level and transaction-level fraud risk assessment
- **Privacy & Security** — Differential privacy, secure aggregation, and cryptographic verification
- **Feature Engineering** — Node and edge feature extraction with temporal windowing and missing data handling
- **Robust Aggregation** — Multiple strategies including FedAvg, robust aggregation, and trust-weighted
- **Model Validation** — Canary generators, conformance checking, and model contract validation
- **Score Calibration** — Isotonic regression-based calibration with cold-start fallback
- **Multiple Backends** — In-process, HTTP, and gRPC communication options
- **Compliance Ready** — Built-in audit trails, SAR support, and serialization for regulatory requirements

## Installation

```bash
pip install federated-graph
```

Optional extras:

```bash
pip install federated-graph[grpc]      # gRPC communication backend
pip install federated-graph[redis]     # Redis-based embedding store
pip install federated-graph[scoring]   # Score calibration with scikit-learn
pip install federated-graph[dev]       # Development tools
pip install federated-graph[all]       # Everything
```

## Quick Start

```python
import torch
from torch_geometric.data import Data
from federated_graph import FGIConfig
from federated_graph.models import FGIModel

# Create configuration
config = FGIConfig()

# Initialize model
model = FGIModel(in_channels=10, config=config.model)

# Prepare graph data
x = torch.randn(100, 10)
edge_index = torch.randint(0, 100, (2, 500))

# Forward pass returns embeddings and risk scores
embeddings, entity_scores, txn_scores = model(x, edge_index)
```

### Federated Training

```python
from federated_graph.federation import FederationServer, FederationClient

server = FederationServer(
    num_rounds=config.federation.num_rounds,
    min_clients=config.federation.min_clients,
)

client = FederationClient(client_id="client_1", model=model, config=config)
```

### Configuration

Pydantic-based configuration with sensible defaults:

```python
from federated_graph import FGIConfig

config = FGIConfig.from_yaml("config.yaml")
config.to_yaml("config_output.yaml")
```

## License

MIT
