# chai-ming-yang/flood-prediction architecture

> Architecture diagram of the GitHub repository chai-ming-yang/flood-prediction, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chai-ming-yang/flood-prediction
- Repository: https://github.com/chai-ming-yang/flood-prediction

## Overview

The product is an interactive flood-prediction notebook backed by pre-trained Random Forest models, with separate Random Forest and LSTM training notebooks for three dataset versions. The documented user flow selects a dataset, presents a feature form, and predicts the next period’s flood status. Relationships below follow README descriptions; source notebooks were not excerpted, so implementation details beyond those descriptions are not inferred.

Main entry points: [`main.ipynb`](https://github.com/chai-ming-yang/flood-prediction/blob/main/main.ipynb) (Dataset selection), [`datasets`](https://github.com/chai-ming-yang/flood-prediction/tree/main/datasets) (Flood datasets), [`src/ML`](https://github.com/chai-ming-yang/flood-prediction/tree/main/src/ML) (ML training), [`src/DL`](https://github.com/chai-ming-yang/flood-prediction/tree/main/src/DL) (DL training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_user_flow["Prediction interface"]
  node_dataset_selection["Dataset selection<br/>[main.ipynb]"]
  node_feature_form["Feature form<br/>[main.ipynb]"]
  node_flood_prediction["Flood prediction<br/>[main.ipynb]"]
end

subgraph group_data["Datasets"]
  node_datasets["Flood datasets"]
end

subgraph group_ml["Random Forest"]
  node_ml_training["ML training"]
  node_ml_models["Trained ML models"]
end

subgraph group_dl["LSTM"]
  node_dl_training["DL training"]
  node_dl_models["Trained DL models"]
end

node_user(("User"))

node_user -->|"chooses dataset"| node_dataset_selection
node_dataset_selection -->|"previews rows"| node_datasets
node_dataset_selection -->|"confirms model"| node_feature_form
node_user -->|"enters features"| node_feature_form
node_feature_form -->|"submits inputs"| node_flood_prediction
node_datasets -->|"provides training data"| node_ml_training
node_ml_training -->|"saves models"| node_ml_models
node_flood_prediction -->|"loads selected model"| node_ml_models
node_datasets -->|"provides training data"| node_dl_training
node_dl_training -->|"saves models"| node_dl_models

click node_dataset_selection "https://github.com/chai-ming-yang/flood-prediction/blob/main/main.ipynb"
click node_feature_form "https://github.com/chai-ming-yang/flood-prediction/blob/main/main.ipynb"
click node_flood_prediction "https://github.com/chai-ming-yang/flood-prediction/blob/main/main.ipynb"
click node_datasets "https://github.com/chai-ming-yang/flood-prediction/tree/main/datasets"
click node_ml_training "https://github.com/chai-ming-yang/flood-prediction/tree/main/src/ML"
click node_ml_models "https://github.com/chai-ming-yang/flood-prediction/tree/main/src/ML/trained_model"
click node_dl_training "https://github.com/chai-ming-yang/flood-prediction/tree/main/src/DL"
click node_dl_models "https://github.com/chai-ming-yang/flood-prediction/tree/main/src/DL/trained_model"

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_dataset_selection,node_feature_form,node_flood_prediction,node_user toneBlue
class node_datasets toneAmber
class node_ml_training,node_ml_models toneMint
class node_dl_training,node_dl_models toneRose
```

## Components

### Prediction interface

- [Dataset selection](https://github.com/chai-ming-yang/flood-prediction/blob/main/main.ipynb): `main.ipynb`
- [Feature form](https://github.com/chai-ming-yang/flood-prediction/blob/main/main.ipynb): `main.ipynb`
- [Flood prediction](https://github.com/chai-ming-yang/flood-prediction/blob/main/main.ipynb): `main.ipynb`

### Datasets

- [Flood datasets](https://github.com/chai-ming-yang/flood-prediction/tree/main/datasets): `datasets`

### Random Forest

- [ML training](https://github.com/chai-ming-yang/flood-prediction/tree/main/src/ML): `src/ML`
- [Trained ML models](https://github.com/chai-ming-yang/flood-prediction/tree/main/src/ML/trained_model): `src/ML/trained_model`

### LSTM

- [DL training](https://github.com/chai-ming-yang/flood-prediction/tree/main/src/DL): `src/DL`
- [Trained DL models](https://github.com/chai-ming-yang/flood-prediction/tree/main/src/DL/trained_model): `src/DL/trained_model`

### Other components

- **User**

## Connections

- User → Dataset selection: chooses dataset (evidence: `README.md`)
- Dataset selection → Flood datasets: previews rows (evidence: `README.md`)
- Dataset selection → Feature form: confirms model (evidence: `README.md`)
- User → Feature form: enters features (evidence: `README.md`)
- Feature form → Flood prediction: submits inputs (evidence: `README.md`)
- Flood datasets → ML training: provides training data (evidence: `README.md`)
- ML training → Trained ML models: saves models (evidence: `README.md`)
- Flood prediction → Trained ML models: loads selected model (evidence: `README.md`)
- Flood datasets → DL training: provides training data (evidence: `README.md`)
- DL training → Trained DL models: saves models (evidence: `README.md`)
