# storieswithsiva/kaggle-predicting-future-sales architecture

> Architecture diagram of the GitHub repository storieswithsiva/kaggle-predicting-future-sales, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/storieswithsiva/kaggle-predicting-future-sales
- Repository: https://github.com/storieswithsiva/kaggle-predicting-future-sales

## Overview

##### Main Components

a) Data Pipeline Layer
- Input Data Sources (show multiple input files)
- sales_train.csv
- test.csv
- items.csv
- item_categories.csv
- shops.csv

b) Feature Engineering Layer
- Lag Feature Generator
- Mean Encoding Processor
- Holiday Feature Generator
- All-Pairs Generator (shop-item combinations)

c) Model Layer
- Primary Model: LightGBM
- Secondary Models:
- XGBoost Model 1
- XGBoost Model 2
- Ensemble Layer (optional)

d) Validation Layer
- Custom Time Series CV (6-fold)
- RMSE Evaluation

##### Important Details to Highlight
- Time series nature of the data (2013-2015)
- Monthly aggregation step
- Lag feature importance (1,2,3,5,12 months)
- Cross-validation strategy (blocks 28-33)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Define styles
    classDef data fill:#b3d9ff,stroke:#333,stroke-width:2px
    classDef feature fill:#90EE90,stroke:#333,stroke-width:2px
    classDef model fill:#FFA07A,stroke:#333,stroke-width:2px
    classDef validation fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef utility fill:#D3D3D3,stroke:#333,stroke-width:2px

    %% Data Layer
    subgraph DataLayer["Data Pipeline Layer"]
        sales[("sales_train.csv")]:::data
        test[("test.csv")]:::data
        items[("items.csv")]:::data
        categories[("item_categories.csv")]:::data
        shops[("shops.csv")]:::data
    end

    %% EDA
    EDA["Exploratory Data Analysis"]:::utility
    click EDA "https://github.com/storieswithsiva/Kaggle-Predicting-Future-Sales/blob/master/EDA.ipynb"

    %% Feature Engineering Layer
    subgraph FeatureLayer["Feature Engineering Layer"]
        lag["Lag Feature Generator"]:::feature
        click lag "https://github.com/storieswithsiva/Kaggle-Predicting-Future-Sales/blob/master/generate_lag_features.ipynb"
        mean["Mean Encoding Processor"]:::feature
        holiday["Holiday Feature Generator"]:::feature
        pairs["All-Pairs Generator"]:::feature
    end

    %% Model Layer
    subgraph ModelLayer["Model Layer"]
        lightgbm[("LightGBM Model")]:::model
        click lightgbm "https://github.com/storieswithsiva/Kaggle-Predicting-Future-Sales/blob/master/lightgbm_tuning.ipynb"
        xgb1[("XGBoost Model 1")]:::model
        click xgb1 "https://github.com/storieswithsiva/Kaggle-Predicting-Future-Sales/blob/master/xgb_tuning.ipynb"
        xgb2[("XGBoost Model 2")]:::model
    end

    %% Ensemble Layer
    ensemble["Ensemble Layer"]:::model
    click ensemble "https://github.com/storieswithsiva/Kaggle-Predicting-Future-Sales/blob/master/ensembling.ipynb"

    %% Validation Layer
    subgraph ValidationLayer["Validation Layer"]
        cv["Custom Time Series CV<br/>(6-fold)"]:::validation
        rmse["RMSE Evaluation"]:::validation
    end

    %% Connections
    DataLayer --> EDA
    EDA --> FeatureLayer
    lag --> ModelLayer
    mean --> ModelLayer
    holiday --> ModelLayer
    pairs --> ModelLayer
    lightgbm --> ensemble
    xgb1 --> ensemble
    xgb2 --> ensemble
    ModelLayer --> ValidationLayer
    ValidationLayer -.-> ModelLayer

    %% Legend
    subgraph Legend
        l1[("Database/Files")]:::data
        l2["Processing"]:::feature
        l3[("Models")]:::model
        l4["Validation"]:::validation
        l5["Utility"]:::utility
    end
```
