# devulapallitharun/interpretable-price-forecasting architecture

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

- Interactive diagram: https://gitdiagram.com/devulapallitharun/interpretable-price-forecasting
- Repository: https://github.com/devulapallitharun/interpretable-price-forecasting

## Overview

This is an Indian food-price forecasting product: historical price and weather data become a feature-rich time-series dataset, XGBoost and Temporal Fusion Transformer (TFT) models produce point and probabilistic forecasts, and ensemble and conformal-calibration stages improve the prediction bands. Evaluation and statistical explainability support a Streamlit dashboard for history, future forecasts, explanations, and test comparisons. The README documents the broader pipeline; sampled source excerpts confirm several training, prediction, fusion, and dashboard internals. Raw input files are described but absent from the supplied tree.

Main entry points: [`data/processed/master_dataset.csv`](https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/data/processed/master_dataset.csv) (Master dataset), [`app.py`](https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/app.py) (Streamlit dashboard), [`scripts/01_fetch_weather.py`](https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/01_fetch_weather.py) (Weather fetching), [`scripts/04_train_xgboost.py`](https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/04_train_xgboost.py) (XGBoost baseline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_filter["Price filtering"]
  node_weather["Weather fetching"]
  node_features["Feature merging"]
  node_master["Master dataset<br/>[master_dataset.csv]"]
end

subgraph group_models["Forecast models"]
  node_xgb["XGBoost baseline"]
  node_tft["TFT training<br/>[03_train_tft.py]"]
  node_retrain["TFT retraining"]
  node_fusion["XGBoost fusion"]
  node_infer["TFT prediction"]
end

subgraph group_post["Forecast refinement"]
  node_ensemble["Checkpoint ensemble"]
  node_calibrate["Conformal calibration"]
  node_evaluate["Forecast evaluation<br/>[06_evaluate.py]"]
  node_stats["Statistical explanations"]
  node_predictions["Forecast artifacts"]
end

subgraph group_serve["Insights and dashboard"]
  node_dashboard["Streamlit dashboard<br/>[app.py]"]
end

node_wfp["WFP price data"]
node_markets["Market coordinates"]
node_nasa(("NASA POWER"))
node_user(("Dashboard user"))

node_wfp -->|"filters prices"| node_filter
node_filter -->|"prepares prices"| node_features
node_markets -->|"provides coordinates"| node_weather
node_weather -->|"fetches weather"| node_nasa
node_weather -->|"supplies weather"| node_features
node_features -->|"writes features"| node_master
node_master -->|"trains baseline"| node_xgb
node_master -->|"trains model"| node_tft
node_master -->|"trains extended"| node_retrain
node_master -->|"trains fused model"| node_fusion
node_xgb -->|"adds feature"| node_fusion
node_tft -->|"generates forecasts"| node_infer
node_retrain -->|"supplies checkpoints"| node_ensemble
node_fusion -->|"supplies checkpoints"| node_ensemble
node_ensemble -->|"writes averages"| node_predictions
node_predictions -->|"calibrates bands"| node_calibrate
node_calibrate -->|"evaluates forecasts"| node_evaluate
node_evaluate -->|"validates results"| node_stats
node_user -->|"views forecasts"| node_dashboard
node_predictions -->|"loads forecasts"| node_dashboard
node_xgb -->|"supports inference"| node_dashboard
node_infer -.->|"supports TFT views"| node_dashboard

click node_filter "https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/00_filter_prices.py"
click node_weather "https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/01_fetch_weather.py"
click node_features "https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/02_merge_features.py"
click node_master "https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/data/processed/master_dataset.csv"
click node_xgb "https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/04_train_xgboost.py"
click node_tft "https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/03_train_tft.py"
click node_retrain "https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/09_retrain_tft_2022.py"
click node_fusion "https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/10_xgb_as_tft_feature.py"
click node_infer "https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/05_generate_tft_predictions.py"
click node_ensemble "https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/07_ensemble_predict.py"
click node_calibrate "https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/08_conformal_calibrate.py"
click node_evaluate "https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/06_evaluate.py"
click node_stats "https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/11_explainability_stats.py"
click node_predictions "https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/data/processed/tft_predictions.csv"
click node_dashboard "https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/app.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_filter,node_weather,node_features,node_master,node_user toneBlue
class node_xgb,node_tft,node_retrain,node_fusion,node_infer toneAmber
class node_ensemble,node_calibrate,node_evaluate,node_stats,node_predictions toneMint
class node_dashboard toneRose
class node_wfp,node_markets,node_nasa toneIndigo
```

## Components

### Data preparation

- [Price filtering](https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/00_filter_prices.py): `scripts/00_filter_prices.py`
- [Weather fetching](https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/01_fetch_weather.py): `scripts/01_fetch_weather.py`
- [Feature merging](https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/02_merge_features.py): `scripts/02_merge_features.py`
- [Master dataset](https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/data/processed/master_dataset.csv): `data/processed/master_dataset.csv`

### Forecast models

- [XGBoost baseline](https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/04_train_xgboost.py): `scripts/04_train_xgboost.py`
- [TFT training](https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/03_train_tft.py): `scripts/03_train_tft.py`
- [TFT retraining](https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/09_retrain_tft_2022.py): `scripts/09_retrain_tft_2022.py`
- [XGBoost fusion](https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/10_xgb_as_tft_feature.py): `scripts/10_xgb_as_tft_feature.py`
- [TFT prediction](https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/05_generate_tft_predictions.py): `scripts/05_generate_tft_predictions.py`

### Forecast refinement

- [Checkpoint ensemble](https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/07_ensemble_predict.py): `scripts/07_ensemble_predict.py`
- [Conformal calibration](https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/08_conformal_calibrate.py): `scripts/08_conformal_calibrate.py`
- [Forecast evaluation](https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/06_evaluate.py): `scripts/06_evaluate.py`
- [Statistical explanations](https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/scripts/11_explainability_stats.py): `scripts/11_explainability_stats.py`
- [Forecast artifacts](https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/data/processed/tft_predictions.csv): `data/processed/tft_predictions.csv`

### Insights and dashboard

- [Streamlit dashboard](https://github.com/devulapallitharun/interpretable-price-forecasting/blob/main/app.py): `app.py`

### Other components

- **WFP price data**
- **Market coordinates**
- **NASA POWER**
- **Dashboard user**

## Connections

- WFP price data → Price filtering: filters prices (evidence: `README.md`)
- Price filtering → Feature merging: prepares prices (evidence: `README.md`)
- Market coordinates → Weather fetching: provides coordinates (evidence: `README.md`)
- Weather fetching → NASA POWER: fetches weather (evidence: `README.md`)
- Weather fetching → Feature merging: supplies weather (evidence: `README.md`)
- Feature merging → Master dataset: writes features (evidence: `README.md`)
- Master dataset → XGBoost baseline: trains baseline (evidence: `scripts/04_train_xgboost.py`)
- Master dataset → TFT training: trains model (evidence: `README.md`)
- Master dataset → TFT retraining: trains extended (evidence: `README.md`)
- Master dataset → XGBoost fusion: trains fused model (evidence: `scripts/10_xgb_as_tft_feature.py`)
- XGBoost baseline → XGBoost fusion: adds feature (evidence: `scripts/10_xgb_as_tft_feature.py`)
- TFT training → TFT prediction: generates forecasts (evidence: `scripts/05_generate_tft_predictions.py`)
- TFT retraining → Checkpoint ensemble: supplies checkpoints (evidence: `README.md`)
- XGBoost fusion → Checkpoint ensemble: supplies checkpoints (evidence: `README.md`)
- Checkpoint ensemble → Forecast artifacts: writes averages (evidence: `scripts/07_ensemble_predict.py`)
- Forecast artifacts → Conformal calibration: calibrates bands (evidence: `README.md`)
- Conformal calibration → Forecast evaluation: evaluates forecasts (evidence: `README.md`)
- Forecast evaluation → Statistical explanations: validates results (evidence: `README.md`)
- Dashboard user → Streamlit dashboard: views forecasts (evidence: `README.md`)
- Forecast artifacts → Streamlit dashboard: loads forecasts (evidence: `README.md`)
- XGBoost baseline → Streamlit dashboard: supports inference (evidence: `README.md`)
- TFT prediction → Streamlit dashboard: supports TFT views
