# sftekin/high-res-crime-forecasting architecture

> Architecture diagram of the GitHub repository sftekin/high-res-crime-forecasting, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sftekin/high-res-crime-forecasting
- Repository: https://github.com/sftekin/high-res-crime-forecasting

## Overview

This repository implements high-resolution crime forecasting experiments over Chicago data, with grid-based, graph-based, and statistical-model workflows. A user starts an experiment runner, which loads configuration, prepares temporal/spatial data, batches train/validation/test windows, and trains or fits models before saving predictions and scores. The graph preserves the documented model and visualization branches. Relationships are limited to calls or references shown in excerpts, the source index, or README; unsampled implementation details are not assumed.

Main entry points: [`run_grid/grid_main.py`](https://github.com/sftekin/high-res-crime-forecasting/blob/main/run_grid/grid_main.py) (Grid experiments), [`run_graph/graph_main.py`](https://github.com/sftekin/high-res-crime-forecasting/blob/main/run_graph/graph_main.py) (Graph experiments), [`data_generators/grid_creator.py`](https://github.com/sftekin/high-res-crime-forecasting/blob/main/data_generators/grid_creator.py) (Grid construction), [`configs`](https://github.com/sftekin/high-res-crime-forecasting/tree/main/configs) (Experiment settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_rawdata["Crime records"]
  node_data_creator["Data ingestion<br/>[data_creator.py]"]
  node_grid_creator["Grid construction<br/>[grid_creator.py]"]
  node_graph_creator["Graph construction<br/>[graph_creator.py]"]
end

subgraph group_learning["Forecasting workflows"]
  node_grid_runner["Grid experiments<br/>[grid_main.py]"]
  node_gpr_runner["Grid GPR experiment<br/>[gpr_experiment.py]"]
  node_graph_runner["Graph experiments<br/>[graph_main.py]"]
  node_highres_runner["High-resolution graph<br/>[graph_high_res.py]"]
  node_sample_runner["Sample prediction"]
  node_stats_runner["Statistical experiments<br/>[stats_main.py]"]
end

subgraph group_models["Forecast models"]
  node_graphgru["Graph ConvGRU<br/>[graph_conv_gru.py]"]
  node_convlstm["ConvLSTM<br/>[convlstm.py]"]
  node_convlstm_one["Single-block ConvLSTM"]
  node_fclstm["Fully connected LSTM<br/>[fc_lstm.py]"]
  node_lstm["LSTM<br/>[lstm.py]"]
  node_statmodels["Statistical models"]
end

subgraph group_support["Training and analysis"]
  node_configs["Experiment settings"]
  node_batching["Window batching<br/>[batch_generator.py]"]
  node_datasets["Batch datasets"]
  node_normalizer["Batch normalization"]
  node_trainer["Model training<br/>[trainer.py]"]
  node_graphhelpers["Graph metrics and mapping<br/>[graph_helper.py]"]
  node_statichelpers["Metrics and splits<br/>[static_helper.py]"]
  node_plotting["Forecast visualization<br/>[plot_helper.py]"]
  node_results["Experiment outputs"]
end

node_researcher(("Researcher"))

node_researcher -->|"starts"| node_grid_runner
node_researcher -->|"starts"| node_graph_runner
node_researcher -->|"starts"| node_stats_runner
node_rawdata -->|"reads"| node_data_creator
node_data_creator -->|"provides records"| node_grid_creator
node_data_creator -->|"provides records"| node_graph_creator
node_configs -->|"configures"| node_grid_runner
node_configs -->|"configures"| node_gpr_runner
node_configs -->|"configures"| node_graph_runner
node_configs -->|"configures"| node_highres_runner
node_configs -->|"configures"| node_sample_runner
node_configs -->|"configures"| node_stats_runner
node_grid_creator -->|"supplies grids"| node_grid_runner
node_grid_creator -->|"supplies grids"| node_gpr_runner
node_grid_creator -->|"supplies grid data"| node_graph_runner
node_graph_creator -->|"supplies graph data"| node_graph_runner
node_grid_creator -->|"supplies grids"| node_highres_runner
node_graph_creator -->|"supplies graph data"| node_sample_runner
node_grid_creator -->|"supplies grids"| node_stats_runner
node_grid_runner -->|"builds batches"| node_batching
node_gpr_runner -->|"builds batches"| node_batching
node_graph_runner -->|"builds batches"| node_batching
node_stats_runner -->|"fits models"| node_statmodels
node_batching -->|"creates datasets"| node_datasets
node_batching -->|"normalizes inputs"| node_normalizer
node_grid_runner -->|"selects model"| node_convlstm
node_grid_runner -->|"selects model"| node_convlstm_one
node_grid_runner -->|"selects model"| node_fclstm
node_graph_runner -->|"selects model"| node_graphgru
node_graph_runner -->|"selects model"| node_lstm
node_grid_runner -->|"trains and predicts"| node_trainer
node_graph_runner -->|"trains and predicts"| node_trainer
node_trainer -->|"computes graph metrics"| node_graphhelpers
node_graph_creator -->|"uses graph utilities"| node_graphhelpers
node_graph_creator -->|"plots data"| node_plotting
node_grid_creator -->|"plots grids"| node_plotting
node_graphhelpers -->|"uses metrics"| node_statichelpers
node_stats_runner -->|"writes scores"| node_results
node_trainer -.->|"saves checkpoints"| node_results

click node_rawdata "https://github.com/sftekin/high-res-crime-forecasting/tree/main/dataset"
click node_data_creator "https://github.com/sftekin/high-res-crime-forecasting/blob/main/data_generators/data_creator.py"
click node_grid_creator "https://github.com/sftekin/high-res-crime-forecasting/blob/main/data_generators/grid_creator.py"
click node_graph_creator "https://github.com/sftekin/high-res-crime-forecasting/blob/main/data_generators/graph_creator.py"
click node_configs "https://github.com/sftekin/high-res-crime-forecasting/tree/main/configs"
click node_grid_runner "https://github.com/sftekin/high-res-crime-forecasting/blob/main/run_grid/grid_main.py"
click node_gpr_runner "https://github.com/sftekin/high-res-crime-forecasting/blob/main/run_grid/gpr_experiment.py"
click node_graph_runner "https://github.com/sftekin/high-res-crime-forecasting/blob/main/run_graph/graph_main.py"
click node_highres_runner "https://github.com/sftekin/high-res-crime-forecasting/blob/main/run_graph/graph_high_res.py"
click node_sample_runner "https://github.com/sftekin/high-res-crime-forecasting/blob/main/run_graph/graph_sample_pred.py"
click node_stats_runner "https://github.com/sftekin/high-res-crime-forecasting/blob/main/run_stats/stats_main.py"
click node_batching "https://github.com/sftekin/high-res-crime-forecasting/blob/main/batch_generators/batch_generator.py"
click node_datasets "https://github.com/sftekin/high-res-crime-forecasting/tree/main/batch_generators"
click node_normalizer "https://github.com/sftekin/high-res-crime-forecasting/blob/main/normalizers/batch_normalizer.py"
click node_trainer "https://github.com/sftekin/high-res-crime-forecasting/blob/main/trainer.py"
click node_graphgru "https://github.com/sftekin/high-res-crime-forecasting/blob/main/models/graph_conv_gru.py"
click node_convlstm "https://github.com/sftekin/high-res-crime-forecasting/blob/main/models/convlstm.py"
click node_convlstm_one "https://github.com/sftekin/high-res-crime-forecasting/blob/main/models/convlstm_one_block.py"
click node_fclstm "https://github.com/sftekin/high-res-crime-forecasting/blob/main/models/fc_lstm.py"
click node_lstm "https://github.com/sftekin/high-res-crime-forecasting/blob/main/models/lstm.py"
click node_statmodels "https://github.com/sftekin/high-res-crime-forecasting/tree/main/models"
click node_graphhelpers "https://github.com/sftekin/high-res-crime-forecasting/blob/main/helpers/graph_helper.py"
click node_statichelpers "https://github.com/sftekin/high-res-crime-forecasting/blob/main/helpers/static_helper.py"
click node_plotting "https://github.com/sftekin/high-res-crime-forecasting/blob/main/helpers/plot_helper.py"
click node_results "https://github.com/sftekin/high-res-crime-forecasting/tree/main/results"

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_rawdata,node_data_creator,node_grid_creator,node_graph_creator toneBlue
class node_grid_runner,node_gpr_runner,node_graph_runner,node_highres_runner,node_sample_runner,node_stats_runner toneAmber
class node_graphgru,node_convlstm,node_convlstm_one,node_fclstm,node_lstm,node_statmodels toneMint
class node_configs,node_batching,node_datasets,node_normalizer,node_trainer,node_graphhelpers,node_statichelpers,node_plotting,node_results toneRose
class node_researcher toneIndigo
```

## Components

### Data preparation

- [Crime records](https://github.com/sftekin/high-res-crime-forecasting/tree/main/dataset): `dataset`
- [Data ingestion](https://github.com/sftekin/high-res-crime-forecasting/blob/main/data_generators/data_creator.py): `data_generators/data_creator.py`
- [Grid construction](https://github.com/sftekin/high-res-crime-forecasting/blob/main/data_generators/grid_creator.py): `data_generators/grid_creator.py`
- [Graph construction](https://github.com/sftekin/high-res-crime-forecasting/blob/main/data_generators/graph_creator.py): `data_generators/graph_creator.py`

### Forecasting workflows

- [Grid experiments](https://github.com/sftekin/high-res-crime-forecasting/blob/main/run_grid/grid_main.py): `run_grid/grid_main.py`
- [Grid GPR experiment](https://github.com/sftekin/high-res-crime-forecasting/blob/main/run_grid/gpr_experiment.py): `run_grid/gpr_experiment.py`
- [Graph experiments](https://github.com/sftekin/high-res-crime-forecasting/blob/main/run_graph/graph_main.py): `run_graph/graph_main.py`
- [High-resolution graph](https://github.com/sftekin/high-res-crime-forecasting/blob/main/run_graph/graph_high_res.py): `run_graph/graph_high_res.py`
- [Sample prediction](https://github.com/sftekin/high-res-crime-forecasting/blob/main/run_graph/graph_sample_pred.py): `run_graph/graph_sample_pred.py`
- [Statistical experiments](https://github.com/sftekin/high-res-crime-forecasting/blob/main/run_stats/stats_main.py): `run_stats/stats_main.py`

### Forecast models

- [Graph ConvGRU](https://github.com/sftekin/high-res-crime-forecasting/blob/main/models/graph_conv_gru.py): `models/graph_conv_gru.py`
- [ConvLSTM](https://github.com/sftekin/high-res-crime-forecasting/blob/main/models/convlstm.py): `models/convlstm.py`
- [Single-block ConvLSTM](https://github.com/sftekin/high-res-crime-forecasting/blob/main/models/convlstm_one_block.py): `models/convlstm_one_block.py`
- [Fully connected LSTM](https://github.com/sftekin/high-res-crime-forecasting/blob/main/models/fc_lstm.py): `models/fc_lstm.py`
- [LSTM](https://github.com/sftekin/high-res-crime-forecasting/blob/main/models/lstm.py): `models/lstm.py`
- [Statistical models](https://github.com/sftekin/high-res-crime-forecasting/tree/main/models): `models`

### Training and analysis

- [Experiment settings](https://github.com/sftekin/high-res-crime-forecasting/tree/main/configs): `configs`
- [Window batching](https://github.com/sftekin/high-res-crime-forecasting/blob/main/batch_generators/batch_generator.py): `batch_generators/batch_generator.py`
- [Batch datasets](https://github.com/sftekin/high-res-crime-forecasting/tree/main/batch_generators): `batch_generators`
- [Batch normalization](https://github.com/sftekin/high-res-crime-forecasting/blob/main/normalizers/batch_normalizer.py): `normalizers/batch_normalizer.py`
- [Model training](https://github.com/sftekin/high-res-crime-forecasting/blob/main/trainer.py): `trainer.py`
- [Graph metrics and mapping](https://github.com/sftekin/high-res-crime-forecasting/blob/main/helpers/graph_helper.py): `helpers/graph_helper.py`
- [Metrics and splits](https://github.com/sftekin/high-res-crime-forecasting/blob/main/helpers/static_helper.py): `helpers/static_helper.py`
- [Forecast visualization](https://github.com/sftekin/high-res-crime-forecasting/blob/main/helpers/plot_helper.py): `helpers/plot_helper.py`
- [Experiment outputs](https://github.com/sftekin/high-res-crime-forecasting/tree/main/results): `results`

### Other components

- **Researcher**

## Connections

- Researcher → Grid experiments: starts (evidence: `run_grid/grid_main.py`)
- Researcher → Graph experiments: starts (evidence: `run_graph/graph_main.py`)
- Researcher → Statistical experiments: starts (evidence: `run_stats/stats_main.py`)
- Crime records → Data ingestion: reads (evidence: `data_generators/data_creator.py`)
- Data ingestion → Grid construction: provides records (evidence: `data_generators/grid_creator.py`)
- Data ingestion → Graph construction: provides records (evidence: `data_generators/graph_creator.py`)
- Experiment settings → Grid experiments: configures (evidence: `run_grid/grid_main.py`)
- Experiment settings → Grid GPR experiment: configures (evidence: `run_grid/gpr_experiment.py`)
- Experiment settings → Graph experiments: configures (evidence: `run_graph/graph_main.py`)
- Experiment settings → High-resolution graph: configures (evidence: `run_graph/graph_high_res.py`)
- Experiment settings → Sample prediction: configures (evidence: `run_graph/graph_sample_pred.py`)
- Experiment settings → Statistical experiments: configures (evidence: `run_stats/stats_main.py`)
- Grid construction → Grid experiments: supplies grids (evidence: `run_grid/grid_main.py`)
- Grid construction → Grid GPR experiment: supplies grids (evidence: `run_grid/gpr_experiment.py`)
- Grid construction → Graph experiments: supplies grid data (evidence: `run_graph/graph_main.py`)
- Graph construction → Graph experiments: supplies graph data (evidence: `run_graph/graph_main.py`)
- Grid construction → High-resolution graph: supplies grids (evidence: `run_graph/graph_high_res.py`)
- Graph construction → Sample prediction: supplies graph data (evidence: `run_graph/graph_sample_pred.py`)
- Grid construction → Statistical experiments: supplies grids (evidence: `run_stats/stats_main.py`)
- Grid experiments → Window batching: builds batches (evidence: `run_grid/grid_main.py`)
- Grid GPR experiment → Window batching: builds batches (evidence: `run_grid/gpr_experiment.py`)
- Graph experiments → Window batching: builds batches (evidence: `run_graph/graph_main.py`)
- Statistical experiments → Statistical models: fits models (evidence: `run_stats/stats_main.py`)
- Window batching → Batch datasets: creates datasets (evidence: `batch_generators/batch_generator.py`)
- Window batching → Batch normalization: normalizes inputs (evidence: `batch_generators/batch_generator.py`)
- Grid experiments → ConvLSTM: selects model (evidence: `run_grid/grid_main.py`)
- Grid experiments → Single-block ConvLSTM: selects model (evidence: `run_grid/grid_main.py`)
- Grid experiments → Fully connected LSTM: selects model (evidence: `run_grid/grid_main.py`)
- Graph experiments → Graph ConvGRU: selects model (evidence: `run_graph/graph_main.py`)
- Graph experiments → LSTM: selects model (evidence: `run_graph/graph_main.py`)
- Grid experiments → Model training: trains and predicts (evidence: `run_grid/grid_main.py`)
- Graph experiments → Model training: trains and predicts (evidence: `run_graph/graph_main.py`)
- Model training → Graph metrics and mapping: computes graph metrics (evidence: `trainer.py`)
- Graph construction → Graph metrics and mapping: uses graph utilities (evidence: `data_generators/graph_creator.py`)
- Graph construction → Forecast visualization: plots data (evidence: `data_generators/graph_creator.py`)
- Grid construction → Forecast visualization: plots grids (evidence: `data_generators/grid_creator.py`)
- Graph metrics and mapping → Metrics and splits: uses metrics (evidence: `helpers/graph_helper.py`)
- Statistical experiments → Experiment outputs: writes scores (evidence: `run_stats/stats_main.py`)
- Model training → Experiment outputs: saves checkpoints
