# abrar2652/qamplifynet architecture

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

- Interactive diagram: https://gitdiagram.com/abrar2652/qamplifynet
- Repository: https://github.com/abrar2652/qamplifynet

## Overview

##### Project type and purpose
- This is a research‐oriented, multi‐pipeline machine‐learning framework for supply chain backorder prediction.
- It orchestrates data ingestion, preprocessing, benchmarking of classical models, a deep Q‐learning agent, quantum‐classical hybrid networks (QAmplifyNet), quantum ensembles, and pure quantum neural networks.

##### File structure
- Top‐level modules:
- Preprocessing – data cleaning, feature‐selection and outlier‐detection notebooks and results
- Classical – 10 classical ML model experiments (ANN, CatBoost, RF, XGBoost, etc.)
- DDQN_RL – deep Q‐learning approach
- QAmplifyNet – the hybrid quantum‐classical neural network core
- QEnsembles – stacking ensembles combining quantum circuits with classical meta‐learners
- QNN – end‐to‐end quantum neural network experiments (CNN+encoder+QNN, MERA, RY‐CNOT)
- Each module contains Jupyter notebooks, artifacts (plots, checkpoints), and subdirectories for detailed experiments.

##### README for architectural cues
- The README calls out 4 benchmark categories: classical, QAmplifyNet, Q‐ensembles, RL.

a. Main components
- Data Ingestion & Storage: Kaggle backorder dataset (CSV files)
- Preprocessing Module: notebooks implementing outlier detection (IFLOF, IQR), scaling, encoding, VIF analysis
- Modelling Pipelines:
– Classical Models (10 algorithms)
– Deep Reinforcement Learning (DDQN)
– Hybrid Quantum‐Classical (QAmplifyNet core)
– Quantum Ensembles (stacking of VQC, qSVM, etc.)
– Pure Quantum Neural Networks (CNN+QNN, MERA, RY‐CNOT)
- Evaluation & Reporting: common metrics calculators, confusion matrices, ROC/PR plots, LIME/SHAP explanations
- Artifacts Storage: generated plots, model checkpoints, tensorboard logs
b. Relationships & interactions
– Raw Data flows into Preprocessing
– Preprocessed data is branched to all modelling pipelines in parallel
– Each pipeline produces evaluation artifacts and logs
– A final benchmarking/aggregation step compares results across pipelines
c. Architectural patterns & principles
– Modular pipeline per experiment type (separation of concerns)
– Reusable preprocessing steps feeding multiple models
– Experiment isolation: each model lives in its own subdirectory with artifacts
– Hybrid quantum‐classical integration via PennyLane or Qiskit (in QAmplifyNet)
d. Technologies & frameworks
– Python, Jupyter notebooks
– Scikit‐learn (classical models, preprocessing)
– LightGBM, XGBoost, CatBoost
– TensorFlow/PyTorch (possibly for QNN encoder/CNN)
– PennyLane/Qiskit for quantum circuits (QAmplifyNet, QEnsembles, QNN)
– OpenAI Gym or custom code for DDQN
– LIME/SHAP for interpretability
– TensorBoard for training visualization

## Diagram (Mermaid)

```mermaid
graph TB
    %% Data Ingestion
    Data["Kaggle Backorder Dataset (CSV)"]:::data
    Data --> Preprocess

    %% Preprocessing Module
    Preprocess["Preprocessing Module"]:::data
    Data --> Preprocess

    subgraph "Preprocessing Module"
        direction TB
        Pnb["Preprocessing.ipynb"]
        P_IFLOF["IFLOF"]
        P_IFLOF_VIF["IFLOF+VIF"]
        P_IQR_VIF["IQR+VIF"]
        P_Log_Std_VIF["Log transform+StandardScaler+VIF"]
        P_NoLog_VIF["No Log transform+VIF"]
        P_RobScalar_VIF["RobScalar+VIF"]
        P_VIF_only["VIF+no outlier detector"]
    end

    Preprocess --> Pnb
    Preprocess --> P_IFLOF
    Preprocess --> P_IFLOF_VIF
    Preprocess --> P_IQR_VIF
    Preprocess --> P_Log_Std_VIF
    Preprocess --> P_NoLog_VIF
    Preprocess --> P_RobScalar_VIF
    Preprocess --> P_VIF_only

    %% Modelling Pipelines
    subgraph "Modelling Pipelines"
        direction LR
        Classical["Classical Models"]:::classical
        DDQN["Deep Q-Learning (DDQN)"]:::classical
        QAmp["QAmplifyNet (Hybrid)"]:::quantum
        QEns["Quantum Ensembles"]:::quantum
        QNN["Quantum Neural Networks"]:::quantum
    end

    Preprocess --> Classical
    Preprocess --> DDQN
    Preprocess --> QAmp
    Preprocess --> QEns
    Preprocess --> QNN

    %% Classical Pipeline Details
    subgraph "Classical Models" 
        direction TB
        Cnb["classical_modelling_short_data.ipynb"]
        C_ANN["ANN"]
        C_Cat["CatBoost"]
        C_DT["Decision Tree"]
        C_KNN["KNN"]
        C_LGBM["LGBM"]
        C_RF["RF"]
        C_SVM["SVM"]
        C_XGB["XGBoost"]
    end
    Classical --> Cnb
    Classical --> C_ANN
    Classical --> C_Cat
    Classical --> C_DT
    Classical --> C_KNN
    Classical --> C_LGBM
    Classical --> C_RF
    Classical --> C_SVM
    Classical --> C_XGB

    %% DDQN Pipeline
    DDQN --> Dnb["DDQN_RL.ipynb"]

    %% QAmplifyNet Pipeline
    subgraph "QAmplifyNet"
        direction TB
        QAmp_nb["QAmplifyNet.ipynb"]
        QAmp_bkp[".qml.drawio.bkp"]
    end
    QAmp --> QAmp_nb
    QAmp --> QAmp_bkp

    %% Quantum Ensembles Pipeline
    subgraph "QEnsembles"
        direction TB
        QEns_nb["QEnsemble.ipynb"]
        QEns_dir1["LGBM_qSVM_as_base_LR_meta_stacking"]
        QEns_dir2["VQC_base_LGBM_meta_stacking"]
        QEns_dir3["VQC_base_qSVM_metaclassifier_stacking"]
    end
    QEns --> QEns_nb
    QEns --> QEns_dir1
    QEns --> QEns_dir2
    QEns --> QEns_dir3

    %% QNN Pipeline
    subgraph "QNN"
        direction TB
        QNN_nb1["NN_Encoder_QNN.ipynb"]
        QNN_nb2["metrics_plots_generation.ipynb"]
        subgraph "MERA"
            direction TB
            MERA1["mera-1-layered.ipynb"]
            MERA2["mera-2-layered.ipynb"]
            MERA4["mera-4-layered.ipynb"]
        end
        QNN_nb3["ry-cnot-vqc.ipynb"]
        subgraph "Outputs"
            direction TB
            Out_models["outputs/models/"]
            Out_conf["outputs/confusion/"]
            Out_tb["outputs/tensorboard/"]
        end
    end
    QNN --> QNN_nb1
    QNN --> QNN_nb2
    QNN --> MERA1
    QNN --> MERA2
    QNN --> MERA4
    QNN --> QNN_nb3
    QNN --> Out_models
    QNN --> Out_conf
    QNN --> Out_tb

    %% Evaluation & Reporting
    Eval["Evaluation & Reporting (Metrics, Plots, LIME/SHAP)"]:::eval
    Classical --> Eval
    DDQN --> Eval
    QAmp --> Eval
    QEns --> Eval
    QNN --> Eval

    %% Artifacts Storage
    Artifacts["Artifacts Storage (plots/, checkpoints, tensorboard)"]:::eval
    Eval --> Artifacts

    %% Click Events
    click Pnb "https://github.com/abrar2652/qamplifynet/blob/main/Preprocessing/Preprocessing.ipynb"
    click P_IFLOF "https://github.com/abrar2652/qamplifynet/tree/main/Preprocessing/IFLOF/"
    click P_IFLOF_VIF "https://github.com/abrar2652/qamplifynet/tree/main/Preprocessing/IFLOF+vif/"
    click P_IQR_VIF "https://github.com/abrar2652/qamplifynet/tree/main/Preprocessing/IQR+vif/"
    click P_Log_Std_VIF "https://github.com/abrar2652/qamplifynet/tree/main/Preprocessing/Log transform+StandardScaler+VIF/"
    click P_NoLog_VIF "https://github.com/abrar2652/qamplifynet/tree/main/Preprocessing/No Log transform+VIF/"
    click P_RobScalar_VIF "https://github.com/abrar2652/qamplifynet/tree/main/Preprocessing/RobScalar+VIF/"
    click P_VIF_only "https://github.com/abrar2652/qamplifynet/tree/main/Preprocessing/VIF+no outlier detector/"

    click Cnb "https://github.com/abrar2652/qamplifynet/blob/main/Classical/classical_modelling_short_data.ipynb"
    click C_ANN "https://github.com/abrar2652/qamplifynet/tree/main/Classical/ANN/"
    click C_Cat "https://github.com/abrar2652/qamplifynet/tree/main/Classical/Catboost/"
    click C_DT "https://github.com/abrar2652/qamplifynet/tree/main/Classical/Decision Tree/"
    click C_KNN "https://github.com/abrar2652/qamplifynet/tree/main/Classical/KNN/"
    click C_LGBM "https://github.com/abrar2652/qamplifynet/tree/main/Classical/LGBM/"
    click C_RF "https://github.com/abrar2652/qamplifynet/tree/main/Classical/RF/"
    click C_SVM "https://github.com/abrar2652/qamplifynet/tree/main/Classical/SVM/"
    click C_XGB "https://github.com/abrar2652/qamplifynet/tree/main/Classical/XGBoost/"

    click Dnb "https://github.com/abrar2652/qamplifynet/blob/main/DDQN_RL/DDQN_RL.ipynb"

    click QAmp_nb "https://github.com/abrar2652/qamplifynet/blob/main/QAmplifyNet/3_dense_layers/QAmplifyNet.ipynb"
    click QAmp_bkp "https://github.com/abrar2652/qamplifynet/blob/main/QAmplifyNet/.$qml.drawio.bkp"

    click QEns_nb "https://github.com/abrar2652/qamplifynet/blob/main/QEnsembles/QEnsemble.ipynb"
    click QEns_dir1 "https://github.com/abrar2652/qamplifynet/tree/main/QEnsembles/LGBM_qSVM_as_base_LR_meta_stacking/"
    click QEns_dir2 "https://github.com/abrar2652/qamplifynet/tree/main/QEnsembles/VQC_base_LGBM_meta_stacking/"
    click QEns_dir3 "https://github.com/abrar2652/qamplifynet/tree/main/QEnsembles/VQC_base_qSVM_metaclassifier_stacking/"

    click QNN_nb1 "https://github.com/abrar2652/qamplifynet/blob/main/QNN/CNN+Encoder+QNN/NN_Encoder_QNN.ipynb"
    click QNN_nb2 "https://github.com/abrar2652/qamplifynet/blob/main/QNN/CNN+Encoder+QNN/metrics_plots_generation.ipynb"
    click MERA1 "https://github.com/abrar2652/qamplifynet/blob/main/QNN/MERA/MERA_1_layered/mera-1-layered.ipynb"
    click MERA2 "https://github.com/abrar2652/qamplifynet/blob/main/QNN/MERA/MERA_2_layered/mera-2-layered.ipynb"
    click MERA4 "https://github.com/abrar2652/qamplifynet/blob/main/QNN/MERA/MERA_4_layered/mera-4-layered.ipynb"
    click QNN_nb3 "https://github.com/abrar2652/qamplifynet/blob/main/QNN/RY-CNOT/ry-cnot-vqc.ipynb"
    click Out_models "https://github.com/abrar2652/qamplifynet/tree/main/QNN/CNN+Encoder+QNN/outputs/models/"
    click Out_conf "https://github.com/abrar2652/qamplifynet/tree/main/QNN/CNN+Encoder+QNN/outputs/confusion/"
    click Out_tb "https://github.com/abrar2652/qamplifynet/tree/main/QNN/CNN+Encoder+QNN/outputs/tensorboard/"

    %% Styles
    classDef data fill:#d5f5e3,stroke:#27AE60
    classDef classical fill:#85C1E9,stroke:#21618C
    classDef quantum fill:#BB8FCE,stroke:#6C3483
    classDef eval fill:#F5B041,stroke:#B9770E
    class Pnb,P_IFLOF,P_IFLOF_VIF,P_IQR_VIF,P_Log_Std_VIF,P_NoLog_VIF,P_RobScalar_VIF,P_VIF_only data
    class Data,Preprocess data
    class Classical,DDQN classical
    class Cnb,C_ANN,C_Cat,C_DT,C_KNN,C_LGBM,C_RF,C_SVM,C_XGB classical
    class QAmp,QEns,QNN quantum
    class QAmp_nb,QAmp_bkp,QEns_nb,QEns_dir1,QEns_dir2,QEns_dir3,QNN_nb1,QNN_nb2,MERA1,MERA2,MERA4,QNN_nb3 quantum
    class Eval,Artifacts eval
```
