# codebyharri/stacking-ensemble-machine-learning architecture

> Architecture diagram of the GitHub repository codebyharri/stacking-ensemble-machine-learning, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/codebyharri/stacking-ensemble-machine-learning
- Repository: https://github.com/codebyharri/stacking-ensemble-machine-learning

## Overview

##### Project type and purpose
- This is a data‐science template implemented as two Jupyter notebooks (classification and regression) that demonstrate a stacked‐generalization (ensemble) pipeline.
- Its goal is to provide a reproducible workflow for hyperparameter tuning (via Optuna), per‐model scaling, and stacking of three optimized base models into a final meta‐model.

##### File structure
- Top‐level:
- IMGs/arch.PNG — the existing system‐architecture sketch
- Stacked_Machine_Learning_Classification.ipynb — classification pipeline notebook
- Stacked_Machine_Learning_Regression.ipynb — regression pipeline notebook
- No separate “src” or “lib” folders; all code lives inside notebooks.
- Configuration and parameters are defined inline and via Optuna trials.

##### README for additional insights
- It lists all candidate models.
- Mentions “three of the above models are chosen, scaled uniquely and tuned” then “tuned inside the above equation” (the meta‐model formula).
- Indicates the core high‐level blocks: data ingestion → model selection & scaling → hyperparameter optimization → stacking equation.

##### Essential detail checklist
- Optuna’s role as a “trial manager” that loops back performance metrics to the base learners.
- Call out the final stacking formula block as the meta‐learner.
- That scaling is “per‐model” (e.g., one scaler instance per base learner).
- IMGs/arch.PNG as a reference or background.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Classification Pipeline
    subgraph "Classification Notebook"
        direction TB
        CI["Data Input"]:::data
        click CI "https://github.com/codebyharri/stacking-ensemble-machine-learning/blob/master/Stacked_Machine_Learning_Classification.ipynb"
        CP["Preprocessing & Feature Scaling"]:::data
        click CP "https://github.com/codebyharri/stacking-ensemble-machine-learning/blob/master/Stacked_Machine_Learning_Classification.ipynb"
        CMZ["Model Zoo (Instantiations)"]:::modeling
        click CMZ "https://github.com/codebyharri/stacking-ensemble-machine-learning/blob/master/Stacked_Machine_Learning_Classification.ipynb"
        CORG["Optuna Orchestrator"]:::optimization
        click CORG "https://github.com/codebyharri/stacking-ensemble-machine-learning/blob/master/Stacked_Machine_Learning_Classification.ipynb"
        CSM["Meta-Model / Stacker"]:::modeling
        click CSM "https://github.com/codebyharri/stacking-ensemble-machine-learning/blob/master/Stacked_Machine_Learning_Classification.ipynb"
        CE["Evaluation & Output"]:::output
        click CE "https://github.com/codebyharri/stacking-ensemble-machine-learning/blob/master/Stacked_Machine_Learning_Classification.ipynb"
        CV["Visualization & Logging"]:::output
        click CV "https://github.com/codebyharri/stacking-ensemble-machine-learning/blob/master/Stacked_Machine_Learning_Classification.ipynb"
        %% Data flow
        CI --> CP --> CMZ --> CORG --> CSM --> CE
        %% Optional taps
        CP -.-> CV
        CORG -.-> CV
        CE -.-> CV
    end

    %% Regression Pipeline
    subgraph "Regression Notebook"
        direction TB
        RI["Data Input"]:::data
        click RI "https://github.com/codebyharri/stacking-ensemble-machine-learning/blob/master/Stacked_Machine_Learning_Regression.ipynb"
        RP["Preprocessing & Feature Scaling"]:::data
        click RP "https://github.com/codebyharri/stacking-ensemble-machine-learning/blob/master/Stacked_Machine_Learning_Regression.ipynb"
        RMZ["Model Zoo (Instantiations)"]:::modeling
        click RMZ "https://github.com/codebyharri/stacking-ensemble-machine-learning/blob/master/Stacked_Machine_Learning_Regression.ipynb"
        RORG["Optuna Orchestrator"]:::optimization
        click RORG "https://github.com/codebyharri/stacking-ensemble-machine-learning/blob/master/Stacked_Machine_Learning_Regression.ipynb"
        RSM["Meta-Model / Stacker"]:::modeling
        click RSM "https://github.com/codebyharri/stacking-ensemble-machine-learning/blob/master/Stacked_Machine_Learning_Regression.ipynb"
        RE["Evaluation & Output"]:::output
        click RE "https://github.com/codebyharri/stacking-ensemble-machine-learning/blob/master/Stacked_Machine_Learning_Regression.ipynb"
        RV["Visualization & Logging"]:::output
        click RV "https://github.com/codebyharri/stacking-ensemble-machine-learning/blob/master/Stacked_Machine_Learning_Regression.ipynb"
        %% Data flow
        RI --> RP --> RMZ --> RORG --> RSM --> RE
        %% Optional taps
        RP -.-> RV
        RORG -.-> RV
        RE -.-> RV
    end

    %% Shared Components Reference
    subgraph "Shared References"
        direction TB
        MZ["Model Zoo (List of Candidates)"]:::reference
        click MZ "https://github.com/codebyharri/stacking-ensemble-machine-learning/blob/master/README.md"
        PRJ["Project Overview & High-Level Diagram"]:::reference
        click PRJ "https://github.com/codebyharri/stacking-ensemble-machine-learning/blob/master/README.md"
        ARCH["Architecture Diagram Reference"]:::reference
        click ARCH "https://github.com/codebyharri/stacking-ensemble-machine-learning/blob/master/IMGs/arch.PNG"
    end

    classDef data fill:#e0f7fa,stroke:#007c91,color:#000
    classDef modeling fill:#dcedc8,stroke:#558b2f,color:#000
    classDef optimization fill:#ffe0b2,stroke:#bf360c,color:#000
    classDef output fill:#e1bee7,stroke:#6a1b9a,color:#000
    classDef reference fill:#f5f5f5,stroke:#9e9e9e,color:#000
```
