# michael-allouche/nn-quantile-extrapolation architecture

> Architecture diagram of the GitHub repository michael-allouche/nn-quantile-extrapolation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/michael-allouche/nn-quantile-extrapolation
- Repository: https://github.com/michael-allouche/nn-quantile-extrapolation

## Overview

This is research code for estimating extreme quantiles from simulated heavy-tailed data, comparing a neural-network estimator with seven EVT estimators. The main workflow configures and samples data, trains a network, saves checkpoints, and evaluates extrapolated quantiles; a separate runner computes classical EVT estimates, which visualization compares with NN results. The README also describes conditional rainfall analysis, but the sampled sources do not establish its implementation flow. Links reflect shown calls or documented capabilities; unsampled wiring is omitted.

Main entry points: [`extreme/data_management.py`](https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/extreme/data_management.py) (Data sampler), [`run.py`](https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/run.py) (Training runner), [`models/__init__.py`](https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/models/__init__.py) (NN model evaluation), [`models/network.py`](https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/models/network.py) (NN training and extrapolation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Simulation"]
  node_sampler["Data sampler<br/>[data_management.py]"]
  node_distributions["Tail distributions<br/>[distributions.py]"]
  node_train_data["Log-spacing data<br/>[data_management.py]"]
end

subgraph group_neural["Neural estimation"]
  node_config["Run configuration<br/>[__init__.py]"]
  node_training_runner["Training runner<br/>[run.py]"]
  node_network["NN training and extrapolation<br/>[network.py]"]
  node_metrics["Training metrics<br/>[metrics.py]"]
  node_checkpoints[("Model checkpoints")]
end

subgraph group_classical["EVT comparison"]
  node_evt_runner["EVT benchmark runner"]
  node_estimators["EVT estimators<br/>[estimators.py]"]
end

subgraph group_results["Evaluation"]
  node_model_evaluation["NN model evaluation<br/>[__init__.py]"]
  node_visualization["Results visualization<br/>[visualization.py]"]
  node_rainfall["Conditional rainfall analysis"]
end

node_researcher(("Researcher"))

node_researcher -->|"configures"| node_training_runner
node_training_runner -->|"loads config"| node_config
node_training_runner -->|"requests data"| node_sampler
node_sampler -->|"instantiates"| node_distributions
node_sampler -->|"builds spacings"| node_train_data
node_training_runner -->|"trains"| node_network
node_network -->|"computes criteria"| node_metrics
node_network -->|"saves checkpoints"| node_checkpoints
node_model_evaluation -->|"loads model"| node_network
node_model_evaluation -->|"loads quantiles"| node_sampler
node_model_evaluation -->|"selects anchor"| node_estimators
node_evt_runner -->|"runs benchmark"| node_estimators
node_estimators -->|"samples data"| node_sampler
node_visualization -->|"plots NN results"| node_model_evaluation
node_visualization -->|"plots EVT results"| node_estimators
node_visualization -->|"loads reference quantiles"| node_sampler
node_researcher -->|"chooses benchmark"| node_evt_runner
node_researcher -.->|"analyzes rainfall"| node_rainfall

click node_config "https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/utils/__init__.py"
click node_sampler "https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/extreme/data_management.py"
click node_distributions "https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/extreme/distributions.py"
click node_train_data "https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/extreme/data_management.py"
click node_training_runner "https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/run.py"
click node_network "https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/models/network.py"
click node_metrics "https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/models/metrics.py"
click node_checkpoints "https://github.com/michael-allouche/nn-quantile-extrapolation/tree/master/ckpt"
click node_model_evaluation "https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/models/__init__.py"
click node_evt_runner "https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/run_evt_estimators.py"
click node_estimators "https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/extreme/estimators.py"
click node_visualization "https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/extreme/visualization.py"
click node_rainfall "https://github.com/michael-allouche/nn-quantile-extrapolation/tree/master/models"

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_sampler,node_distributions,node_train_data toneBlue
class node_config,node_training_runner,node_network,node_metrics,node_checkpoints toneAmber
class node_evt_runner,node_estimators toneMint
class node_model_evaluation,node_visualization,node_rainfall toneRose
class node_researcher toneIndigo
```

## Components

### Simulation

- [Data sampler](https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/extreme/data_management.py): `extreme/data_management.py`
- [Tail distributions](https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/extreme/distributions.py): `extreme/distributions.py`
- [Log-spacing data](https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/extreme/data_management.py): `extreme/data_management.py`

### Neural estimation

- [Run configuration](https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/utils/__init__.py): `utils/__init__.py`
- [Training runner](https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/run.py): `run.py`
- [NN training and extrapolation](https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/models/network.py): `models/network.py`
- [Training metrics](https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/models/metrics.py): `models/metrics.py`
- [Model checkpoints](https://github.com/michael-allouche/nn-quantile-extrapolation/tree/master/ckpt): `ckpt`

### EVT comparison

- [EVT benchmark runner](https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/run_evt_estimators.py): `run_evt_estimators.py`
- [EVT estimators](https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/extreme/estimators.py): `extreme/estimators.py`

### Evaluation

- [NN model evaluation](https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/models/__init__.py): `models/__init__.py`
- [Results visualization](https://github.com/michael-allouche/nn-quantile-extrapolation/blob/master/extreme/visualization.py): `extreme/visualization.py`
- [Conditional rainfall analysis](https://github.com/michael-allouche/nn-quantile-extrapolation/tree/master/models): `models`

### Other components

- **Researcher**

## Connections

- Researcher → Training runner: configures (evidence: `README.md`)
- Training runner → Run configuration: loads config (evidence: `run.py`)
- Training runner → Data sampler: requests data (evidence: `run.py`)
- Data sampler → Tail distributions: instantiates (evidence: `extreme/data_management.py`)
- Data sampler → Log-spacing data: builds spacings (evidence: `extreme/data_management.py`)
- Training runner → NN training and extrapolation: trains (evidence: `run.py`)
- NN training and extrapolation → Training metrics: computes criteria (evidence: `models/network.py`)
- NN training and extrapolation → Model checkpoints: saves checkpoints (evidence: `models/network.py`)
- NN model evaluation → NN training and extrapolation: loads model (evidence: `models/__init__.py`)
- NN model evaluation → Data sampler: loads quantiles (evidence: `models/__init__.py`)
- NN model evaluation → EVT estimators: selects anchor (evidence: `models/__init__.py`)
- EVT benchmark runner → EVT estimators: runs benchmark (evidence: `run_evt_estimators.py`)
- EVT estimators → Data sampler: samples data (evidence: `extreme/estimators.py`)
- Results visualization → NN model evaluation: plots NN results (evidence: `extreme/visualization.py`)
- Results visualization → EVT estimators: plots EVT results (evidence: `extreme/visualization.py`)
- Results visualization → Data sampler: loads reference quantiles (evidence: `extreme/visualization.py`)
- Researcher → EVT benchmark runner: chooses benchmark (evidence: `README.md`)
- Researcher → Conditional rainfall analysis: analyzes rainfall (evidence: `README.md`)
