# akash32145/house-price-prediction architecture

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

- Interactive diagram: https://gitdiagram.com/akash32145/house-price-prediction
- Repository: https://github.com/akash32145/house-price-prediction

## Overview

##### Project Type and Purpose
- Type: A stand-alone Python machine-learning pipeline (not a web app or microservice).
- Purpose: Load a CSV housing dataset, split it into train/test sets (with StratifiedShuffleSplit), train a RandomForestRegressor model, and output price predictions.

##### File Structure
- README.md: Project description & instructions.
- housing.csv: The single data source (California housing dataset).
- main.py: Contains all pipeline logic: data ingestion, preprocessing, splitting, model training, evaluation, and prediction.

##### README Insights
- Uses pure Python + scikit-learn.
- Relies on StratifiedShuffleSplit for dataset partitioning.
- Employs RandomForest classifier (used for regression here) as the predictive model.
- Raw project: no web UI or API—CLI/interactive script.

##### Main Components
a. Data Source
– Component: housing.csv (California housing data)
b. Data Loader & Preprocessor
– Reads CSV, handles missing values, feature engineering (if any).
c. Dataset Splitter
– StratifiedShuffleSplit logic separating train/test.
d. Model Trainer
– RandomForestRegressor from scikit-learn (configured hyperparameters).
e. Model Evaluator
– Computes performance metrics (e.g., RMSE, MAE).
f. Prediction Interface
– CLI or script entry point in main.py that outputs predictions.
g. (Optional) Model Persistence
– If the script serializes the trained model (e.g., pickle), show a “Model Storage” component.

##### Relationships & Data Flows
- Data Loader → Preprocessor
- Preprocessor → Dataset Splitter
- Train portion → Model Trainer → Model Evaluator
- Model Evaluator → Prediction Interface (or console output)
- (If implemented) Model Trainer → Model Storage (pickled file) → Prediction Interface

##### Architectural Patterns & Design Principles
- Pipeline pattern: sequential steps from raw data to predictions.
- Single responsibility per component: loader, splitter, trainer, evaluator.
- Decouple data ingestion from model logic (even if in the same file, conceptually separate).

##### Technologies & Frameworks to Label
- Python 3.x
- pandas or csv module (for data loading)
- scikit-learn StratifiedShuffleSplit
- scikit-learn RandomForestRegressor
- (Optional) pickle or joblib for model persistence

##### Detail Without Overthinking
- Even though the project code lives in one file, conceptually split it into components.
- Explicitly show each step in the pipeline so that stakeholders can see where to plug in new data or swap models.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Nodes
    Source["housing.csv"]:::dataIO
    Loader["Data Loader & Preprocessor"]:::dataIO
    Splitter["Dataset Splitter\n(StratifiedShuffleSplit\n test_size=0.2, random_state=42)"]:::processing
    Trainer["Model Trainer\n(RandomForestRegressor\n n_estimators=100)"]:::modeling
    Evaluator["Model Evaluator\n(RMSE/MAE)"]:::modeling
    Interface["Prediction Interface\n(CLI Output)"]:::interface

    %% Flow
    Source -->|"raw CSV"| Loader
    Loader -->|"cleaned data"| Splitter
    Splitter -->|"training & test sets"| Trainer
    Trainer -->|"trained model"| Evaluator
    Evaluator -->|"metrics & predictions"| Interface

    %% Click Events
    click Source "https://github.com/akash32145/house-price-prediction/blob/main/housing.csv"
    click Loader "https://github.com/akash32145/house-price-prediction/blob/main/main.py"
    click Splitter "https://github.com/akash32145/house-price-prediction/blob/main/main.py"
    click Trainer "https://github.com/akash32145/house-price-prediction/blob/main/main.py"
    click Evaluator "https://github.com/akash32145/house-price-prediction/blob/main/main.py"
    click Interface "https://github.com/akash32145/house-price-prediction/blob/main/main.py"

    %% Styles
    classDef dataIO fill:#D6EAF8,stroke:#3498DB,color:#1B4F72;
    classDef processing fill:#FCF3CF,stroke:#F1C40F,color:#7D6608;
    classDef modeling fill:#D5F5E3,stroke:#2ECC71,color:#145A32;
    classDef interface fill:#EAECF0,stroke:#95A5A6,color:#424949;
```
