# ezracalis/singapore-hdb-price-prediction architecture

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

- Interactive diagram: https://gitdiagram.com/ezracalis/singapore-hdb-price-prediction
- Repository: https://github.com/ezracalis/singapore-hdb-price-prediction

## Overview

##### Project type and purpose
- This is a data‐science/ML pipeline project whose goal is to predict HDB resale prices using historical tabular data and linear/regression models.
- There is no frontend or web service; instead it consists of a sequence of Jupyter notebooks, raw and processed data files, model artifacts, and a slide deck.

##### File structure
- Top-level directories:
- code/ – Jupyter notebooks for each stage of the pipeline (Cleaning & EDA, Feature Engineering, Modeling, Feature Selection, Production Model, Kaggle Submission)
- data/ – raw and intermediate CSVs plus model artifact (05_final_lr_model.pkl) and final results
- slidedeck/ – PDF presentation of findings
- The presence of “.ipynb_checkpoints” shows iterative notebook development.
- No REST API or microservice containers; this is a batch pipeline.

##### README for additional insights
- Problem statement: predict resale value via linear, ridge, lasso regression
- Methodology steps correspond directly to the notebooks in code/
- Final outputs: model pickle file and Kaggle submission CSV

##### Main components
a. Data Sources & Storage
- Raw data files (train.csv, test.csv)
- Intermediate CSVs (cleaned, feature‐engineered)
- Model artifact store (05_final_lr_model.pkl)
1. Data Cleaning & EDA
2. Feature Engineering
3. Initial Modeling & Evaluation
4. Feature Selection & Model Tuning
5. Production Model Training (Linear, Ridge, Lasso)
6. Model Evaluation & Selection
7. Kaggle Submission Generation
c. External Services
- Kaggle API (for pushing submission.csv)
d. Presentation Layer
- slidedeck/ – summarises results

##### Architectural patterns & design principles
- Linear, sequential ETL/ML pipeline
- Separation of concerns: each notebook handles one stage
- Reproducibility: explicit intermediate CSVs and versioned notebook checkpoints
- Artifact management: model pickle and CSV results

##### Technologies & frameworks
- Python, Jupyter Notebook
- pandas, scikit-learn
- pickle for model serialization
- Kaggle API for submission

##### Elements
- Blue for data files
- Green for processing notebooks
- Orange for model artifacts
- Purple for external services

##### Detail but avoid over-engineering
- Six notebook stages as distinct components
- Intermediate CSV outputs as separate nodes
- Model outputs (pickle and submission.csv)
- Connection to the presentation (slidedeck) as a “reporting” artifact

## Diagram (Mermaid)

```mermaid
flowchart TB
  subgraph "Data"
    TrainCSV["train.csv"]:::data
    TestCSV["test.csv"]:::data
    CleanedCSV["01_cleaning_and_eda.csv"]:::data
    FECSV["02_feature_engineering.csv"]:::data
    ModelCSV["03_first_model.csv"]:::data
    CleanedDF["04_cleaned_df.csv"]:::data
  end

  subgraph "Processing"
    Notebook1["01_Cleaning_and_EDA.ipynb"]:::code
    Notebook2["02_Feature_Engineering.ipynb"]:::code
    Notebook3["03_Modeling.ipynb"]:::code
    Notebook4["04_Feature_Selection.ipynb"]:::code
    Notebook5["05_Production_Model_and_Insights.ipynb"]:::code
    Notebook6["06_Kaggle_Submissions.ipynb"]:::code
  end

  subgraph "Artifacts and Output"
    ModelPKL["05_final_lr_model.pkl"]:::artifact
    ResultCSV["06_final_result.csv"]:::artifact
    SampleSub["sample_sub_reg.csv"]:::artifact
    Slide["Project 2_ HDB Resale Prices.pdf"]:::artifact
  end

  KaggleAPI["Kaggle API"]:::external

  TrainCSV -->|load data| Notebook1
  TestCSV -->|load data| Notebook1
  Notebook1 -->|impute nulls, EDA| CleanedCSV
  CleanedCSV -->|transform features| Notebook2
  Notebook2 -->|feature engineering| FECSV
  FECSV -->|train initial models| Notebook3
  Notebook3 -->|evaluate models| ModelCSV
  ModelCSV -->|select features| Notebook4
  Notebook4 -->|tune models| CleanedDF
  CleanedDF -->|train final models| Notebook5
  Notebook5 -->|serialize model| ModelPKL
  ModelPKL -->|generate submission| Notebook6
  TestCSV -->|prepare test| Notebook6
  Notebook6 -->|output submission| ResultCSV
  ResultCSV -->|format| SampleSub
  SampleSub -->|submit| KaggleAPI
  ModelPKL -->|report| Slide

  click TrainCSV "https://github.com/ezracalis/singapore-hdb-price-prediction/blob/main/data/train.csv"
  click TestCSV "https://github.com/ezracalis/singapore-hdb-price-prediction/blob/main/data/test.csv"
  click CleanedCSV "https://github.com/ezracalis/singapore-hdb-price-prediction/blob/main/data/01_cleaning_and_eda.csv"
  click FECSV "https://github.com/ezracalis/singapore-hdb-price-prediction/blob/main/data/02_feature_engineering.csv"
  click ModelCSV "https://github.com/ezracalis/singapore-hdb-price-prediction/blob/main/data/03_first_model.csv"
  click CleanedDF "https://github.com/ezracalis/singapore-hdb-price-prediction/blob/main/data/04_cleaned_df.csv"
  click ModelPKL "https://github.com/ezracalis/singapore-hdb-price-prediction/blob/main/data/05_final_lr_model.pkl"
  click ResultCSV "https://github.com/ezracalis/singapore-hdb-price-prediction/blob/main/data/06_final_result.csv"
  click SampleSub "https://github.com/ezracalis/singapore-hdb-price-prediction/blob/main/data/sample_sub_reg.csv"
  click Notebook1 "https://github.com/ezracalis/singapore-hdb-price-prediction/blob/main/code/01_Cleaning_and_EDA.ipynb"
  click Notebook2 "https://github.com/ezracalis/singapore-hdb-price-prediction/blob/main/code/02_Feature_Engineering.ipynb"
  click Notebook3 "https://github.com/ezracalis/singapore-hdb-price-prediction/blob/main/code/03_Modeling.ipynb"
  click Notebook4 "https://github.com/ezracalis/singapore-hdb-price-prediction/blob/main/code/04_Feature_Selection.ipynb"
  click Notebook5 "https://github.com/ezracalis/singapore-hdb-price-prediction/blob/main/code/05_Production_Model_and_Insights.ipynb"
  click Notebook6 "https://github.com/ezracalis/singapore-hdb-price-prediction/blob/main/code/06_Kaggle_Submissions.ipynb"
  click Slide "https://github.com/ezracalis/singapore-hdb-price-prediction/blob/main/slidedeck/Project 2_ HDB Resale Prices.pdf"

  classDef data fill:#AED6F1,stroke:#1B4F72,color:#1B2631;
  classDef code fill:#ABEBC6,stroke:#1D8348,color:#145A32;
  classDef artifact fill:#F9E79F,stroke:#B9770E,color:#7D6608;
  classDef external fill:#D2B4DE,stroke:#6C3483,color:#4A235A;
```
