# aidotse/amlgentex architecture

> Architecture diagram of the GitHub repository aidotse/amlgentex, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aidotse/amlgentex
- Repository: https://github.com/aidotse/amlgentex

## Overview

AMLGentex is a research framework for synthetic AML transaction-data generation, feature preparation, model training/evaluation, tuning, and network exploration. The principal workflow generates spatial transaction topology and temporal activity, preprocesses the resulting data, then trains and evaluates a selected model. Separate branches support data/model optimization and interactive visualization. Edges reflect README workflow statements or visible source references/calls; several unsampled subsystems are represented at their exact directory or module paths, so their internal wiring is intentionally limited.

Main entry points: [`src/data_creation/spatial_simulation/transaction_graph_generator.py`](https://github.com/aidotse/amlgentex/blob/main/src/data_creation/spatial_simulation/transaction_graph_generator.py) (Spatial graph), [`src/data_creation/temporal_simulation/simulator.py`](https://github.com/aidotse/amlgentex/blob/main/src/data_creation/temporal_simulation/simulator.py) (Temporal simulation), [`src/ml/training`](https://github.com/aidotse/amlgentex/tree/main/src/ml/training) (Training regimes), [`src/data_tuning/optimizer.py`](https://github.com/aidotse/amlgentex/blob/main/src/data_tuning/optimizer.py) (Bayesian optimizer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_generation["Synthetic Data"]
  node_generate_cli["Generate command<br/>[generate.py]"]
  node_data_generator["Data generator<br/>[generator.py]"]
  node_spatial_graph["Spatial graph"]
  node_scale_free["Scale-free topology"]
  node_account_selection["Account selection"]
  node_demographics["Demographics assignment"]
  node_temporal_sim["Temporal simulation<br/>[simulator.py]"]
  node_accounts["Account behavior<br/>[account.py]"]
  node_normal_patterns["Normal patterns<br/>[normal_models.py]"]
  node_alert_patterns["Alert patterns<br/>[alert_patterns.py]"]
end

subgraph group_preparation["Feature Preparation"]
  node_preprocess_cli["Preprocess command<br/>[preprocess.py]"]
  node_preprocessor["Feature preprocessing<br/>[preprocessor.py]"]
  node_feature_summary["Feature summary<br/>[summary.py]"]
  node_noise["Feature noise<br/>[noise.py]"]
end

subgraph group_learning["Modeling and Training"]
  node_train_cli["Train command<br/>[train.py]"]
  node_training_regimes["Training regimes"]
  node_clients["Training clients"]
  node_graph_client["Graph client"]
  node_models["Model families"]
  node_losses["Training losses<br/>[losses.py]"]
  node_metrics["Evaluation metrics<br/>[metrics.py]"]
  node_config["Training configuration<br/>[config.py]"]
end

subgraph group_tuning["Optimization"]
  node_data_tuner["Data tuner<br/>[tuner.py]"]
  node_optimizer["Bayesian optimizer<br/>[optimizer.py]"]
  node_hyperparam_tuner["Hyperparameter tuning"]
end

subgraph group_exploration["Visualization"]
  node_visualization["Data and feature views"]
  node_network_explorer["Transaction explorer"]
  node_dashboard["Explorer dashboard<br/>[dashboard.py]"]
end

node_researcher(("Researcher"))

node_researcher -->|"starts generation"| node_generate_cli
node_generate_cli -.->|"runs generator"| node_data_generator
node_data_generator -->|"uses topology"| node_spatial_graph
node_data_generator -->|"runs simulation"| node_temporal_sim
node_spatial_graph -.->|"builds topology"| node_scale_free
node_spatial_graph -->|"selects accounts"| node_account_selection
node_spatial_graph -->|"assigns demographics"| node_demographics
node_temporal_sim -->|"uses accounts"| node_accounts
node_temporal_sim -->|"executes normal"| node_normal_patterns
node_temporal_sim -->|"schedules alerts"| node_alert_patterns
node_researcher -->|"engineers features"| node_preprocess_cli
node_preprocess_cli -.->|"runs preprocessing"| node_preprocessor
node_researcher -->|"trains models"| node_train_cli
node_train_cli -->|"selects regime"| node_training_regimes
node_training_regimes -->|"dispatches training"| node_clients
node_training_regimes -->|"configures models"| node_models
node_training_regimes -->|"loads configuration"| node_config
node_clients -->|"includes graph client"| node_graph_client
node_graph_client -->|"constructs loss"| node_losses
node_graph_client -->|"evaluates with"| node_metrics
node_researcher -->|"tunes data"| node_data_tuner
node_data_tuner -->|"runs optimization"| node_optimizer
node_optimizer -->|"regenerates data"| node_data_generator
node_optimizer -->|"preprocesses trials"| node_preprocessor
node_optimizer -->|"tunes model"| node_hyperparam_tuner
node_researcher -->|"explores results"| node_visualization
node_researcher -->|"explores networks"| node_network_explorer
node_dashboard -->|"uses explorer"| node_network_explorer

click node_generate_cli "https://github.com/aidotse/amlgentex/blob/main/scripts/generate.py"
click node_data_generator "https://github.com/aidotse/amlgentex/blob/main/src/data_creation/generator.py"
click node_spatial_graph "https://github.com/aidotse/amlgentex/blob/main/src/data_creation/spatial_simulation/transaction_graph_generator.py"
click node_scale_free "https://github.com/aidotse/amlgentex/blob/main/src/data_creation/spatial_simulation/generate_scalefree.py"
click node_account_selection "https://github.com/aidotse/amlgentex/blob/main/src/data_creation/spatial_simulation/ml_account_selector.py"
click node_demographics "https://github.com/aidotse/amlgentex/blob/main/src/data_creation/spatial_simulation/demographics_assigner.py"
click node_temporal_sim "https://github.com/aidotse/amlgentex/blob/main/src/data_creation/temporal_simulation/simulator.py"
click node_accounts "https://github.com/aidotse/amlgentex/blob/main/src/data_creation/temporal_simulation/account.py"
click node_normal_patterns "https://github.com/aidotse/amlgentex/blob/main/src/data_creation/temporal_simulation/normal_models.py"
click node_alert_patterns "https://github.com/aidotse/amlgentex/blob/main/src/data_creation/temporal_simulation/alert_patterns.py"
click node_preprocess_cli "https://github.com/aidotse/amlgentex/blob/main/scripts/preprocess.py"
click node_preprocessor "https://github.com/aidotse/amlgentex/blob/main/src/feature_engineering/preprocessor.py"
click node_feature_summary "https://github.com/aidotse/amlgentex/blob/main/src/feature_engineering/summary.py"
click node_noise "https://github.com/aidotse/amlgentex/blob/main/src/feature_engineering/noise.py"
click node_train_cli "https://github.com/aidotse/amlgentex/blob/main/scripts/train.py"
click node_training_regimes "https://github.com/aidotse/amlgentex/tree/main/src/ml/training"
click node_clients "https://github.com/aidotse/amlgentex/tree/main/src/ml/clients"
click node_graph_client "https://github.com/aidotse/amlgentex/blob/main/src/ml/clients/torch_geometric_client.py"
click node_models "https://github.com/aidotse/amlgentex/tree/main/src/ml/models"
click node_losses "https://github.com/aidotse/amlgentex/blob/main/src/ml/models/losses.py"
click node_metrics "https://github.com/aidotse/amlgentex/blob/main/src/ml/metrics/metrics.py"
click node_config "https://github.com/aidotse/amlgentex/blob/main/src/utils/config.py"
click node_data_tuner "https://github.com/aidotse/amlgentex/blob/main/src/data_tuning/tuner.py"
click node_optimizer "https://github.com/aidotse/amlgentex/blob/main/src/data_tuning/optimizer.py"
click node_hyperparam_tuner "https://github.com/aidotse/amlgentex/blob/main/src/ml/training/hyperparameter_tuning.py"
click node_visualization "https://github.com/aidotse/amlgentex/tree/main/src/visualize"
click node_network_explorer "https://github.com/aidotse/amlgentex/blob/main/src/visualize/transaction_network_explorer/transaction_network_explorer.py"
click node_dashboard "https://github.com/aidotse/amlgentex/blob/main/src/visualize/transaction_network_explorer/dashboard.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_generate_cli,node_data_generator,node_spatial_graph,node_scale_free,node_account_selection,node_demographics,node_temporal_sim,node_accounts,node_normal_patterns,node_alert_patterns toneBlue
class node_preprocess_cli,node_preprocessor,node_feature_summary,node_noise toneAmber
class node_train_cli,node_training_regimes,node_clients,node_graph_client,node_models,node_losses,node_metrics,node_config toneMint
class node_data_tuner,node_optimizer,node_hyperparam_tuner toneRose
class node_visualization,node_network_explorer,node_dashboard,node_researcher toneIndigo
```

## Components

### Synthetic Data

- [Generate command](https://github.com/aidotse/amlgentex/blob/main/scripts/generate.py): `scripts/generate.py`
- [Data generator](https://github.com/aidotse/amlgentex/blob/main/src/data_creation/generator.py): `src/data_creation/generator.py`
- [Spatial graph](https://github.com/aidotse/amlgentex/blob/main/src/data_creation/spatial_simulation/transaction_graph_generator.py): `src/data_creation/spatial_simulation/transaction_graph_generator.py`
- [Scale-free topology](https://github.com/aidotse/amlgentex/blob/main/src/data_creation/spatial_simulation/generate_scalefree.py): `src/data_creation/spatial_simulation/generate_scalefree.py`
- [Account selection](https://github.com/aidotse/amlgentex/blob/main/src/data_creation/spatial_simulation/ml_account_selector.py): `src/data_creation/spatial_simulation/ml_account_selector.py`
- [Demographics assignment](https://github.com/aidotse/amlgentex/blob/main/src/data_creation/spatial_simulation/demographics_assigner.py): `src/data_creation/spatial_simulation/demographics_assigner.py`
- [Temporal simulation](https://github.com/aidotse/amlgentex/blob/main/src/data_creation/temporal_simulation/simulator.py): `src/data_creation/temporal_simulation/simulator.py`
- [Account behavior](https://github.com/aidotse/amlgentex/blob/main/src/data_creation/temporal_simulation/account.py): `src/data_creation/temporal_simulation/account.py`
- [Normal patterns](https://github.com/aidotse/amlgentex/blob/main/src/data_creation/temporal_simulation/normal_models.py): `src/data_creation/temporal_simulation/normal_models.py`
- [Alert patterns](https://github.com/aidotse/amlgentex/blob/main/src/data_creation/temporal_simulation/alert_patterns.py): `src/data_creation/temporal_simulation/alert_patterns.py`

### Feature Preparation

- [Preprocess command](https://github.com/aidotse/amlgentex/blob/main/scripts/preprocess.py): `scripts/preprocess.py`
- [Feature preprocessing](https://github.com/aidotse/amlgentex/blob/main/src/feature_engineering/preprocessor.py): `src/feature_engineering/preprocessor.py`
- [Feature summary](https://github.com/aidotse/amlgentex/blob/main/src/feature_engineering/summary.py): `src/feature_engineering/summary.py`
- [Feature noise](https://github.com/aidotse/amlgentex/blob/main/src/feature_engineering/noise.py): `src/feature_engineering/noise.py`

### Modeling and Training

- [Train command](https://github.com/aidotse/amlgentex/blob/main/scripts/train.py): `scripts/train.py`
- [Training regimes](https://github.com/aidotse/amlgentex/tree/main/src/ml/training): `src/ml/training`
- [Training clients](https://github.com/aidotse/amlgentex/tree/main/src/ml/clients): `src/ml/clients`
- [Graph client](https://github.com/aidotse/amlgentex/blob/main/src/ml/clients/torch_geometric_client.py): `src/ml/clients/torch_geometric_client.py`
- [Model families](https://github.com/aidotse/amlgentex/tree/main/src/ml/models): `src/ml/models`
- [Training losses](https://github.com/aidotse/amlgentex/blob/main/src/ml/models/losses.py): `src/ml/models/losses.py`
- [Evaluation metrics](https://github.com/aidotse/amlgentex/blob/main/src/ml/metrics/metrics.py): `src/ml/metrics/metrics.py`
- [Training configuration](https://github.com/aidotse/amlgentex/blob/main/src/utils/config.py): `src/utils/config.py`

### Optimization

- [Data tuner](https://github.com/aidotse/amlgentex/blob/main/src/data_tuning/tuner.py): `src/data_tuning/tuner.py`
- [Bayesian optimizer](https://github.com/aidotse/amlgentex/blob/main/src/data_tuning/optimizer.py): `src/data_tuning/optimizer.py`
- [Hyperparameter tuning](https://github.com/aidotse/amlgentex/blob/main/src/ml/training/hyperparameter_tuning.py): `src/ml/training/hyperparameter_tuning.py`

### Visualization

- [Data and feature views](https://github.com/aidotse/amlgentex/tree/main/src/visualize): `src/visualize`
- [Transaction explorer](https://github.com/aidotse/amlgentex/blob/main/src/visualize/transaction_network_explorer/transaction_network_explorer.py): `src/visualize/transaction_network_explorer/transaction_network_explorer.py`
- [Explorer dashboard](https://github.com/aidotse/amlgentex/blob/main/src/visualize/transaction_network_explorer/dashboard.py): `src/visualize/transaction_network_explorer/dashboard.py`

### Other components

- **Researcher**

## Connections

- Researcher → Generate command: starts generation
- Generate command → Data generator: runs generator
- Data generator → Spatial graph: uses topology (evidence: `src/data_creation/generator.py`)
- Data generator → Temporal simulation: runs simulation (evidence: `src/data_creation/generator.py`)
- Spatial graph → Scale-free topology: builds topology
- Spatial graph → Account selection: selects accounts (evidence: `src/data_creation/spatial_simulation/transaction_graph_generator.py`)
- Spatial graph → Demographics assignment: assigns demographics (evidence: `src/data_creation/spatial_simulation/transaction_graph_generator.py`)
- Temporal simulation → Account behavior: uses accounts (evidence: `src/data_creation/temporal_simulation/simulator.py`)
- Temporal simulation → Normal patterns: executes normal (evidence: `src/data_creation/temporal_simulation/simulator.py`)
- Temporal simulation → Alert patterns: schedules alerts (evidence: `src/data_creation/temporal_simulation/simulator.py`)
- Researcher → Preprocess command: engineers features
- Preprocess command → Feature preprocessing: runs preprocessing
- Researcher → Train command: trains models
- Train command → Training regimes: selects regime
- Training regimes → Training clients: dispatches training (evidence: `src/ml/training/federated.py`)
- Training regimes → Model families: configures models (evidence: `src/ml/training/federated.py`)
- Training regimes → Training configuration: loads configuration (evidence: `src/ml/training/federated.py`)
- Training clients → Graph client: includes graph client (evidence: `src/ml/clients/__init__.py`)
- Graph client → Training losses: constructs loss (evidence: `src/ml/clients/torch_geometric_client.py`)
- Graph client → Evaluation metrics: evaluates with (evidence: `src/ml/clients/torch_geometric_client.py`)
- Researcher → Data tuner: tunes data
- Data tuner → Bayesian optimizer: runs optimization (evidence: `src/data_tuning/tuner.py`)
- Bayesian optimizer → Data generator: regenerates data (evidence: `src/data_tuning/optimizer.py`)
- Bayesian optimizer → Feature preprocessing: preprocesses trials (evidence: `src/data_tuning/optimizer.py`)
- Bayesian optimizer → Hyperparameter tuning: tunes model (evidence: `src/data_tuning/optimizer.py`)
- Researcher → Data and feature views: explores results
- Researcher → Transaction explorer: explores networks
- Explorer dashboard → Transaction explorer: uses explorer (evidence: `src/visualize/transaction_network_explorer/dashboard.py`)
