# jayantuppal/intrusion-detection-system architecture

> Architecture diagram of the GitHub repository jayantuppal/intrusion-detection-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jayantuppal/intrusion-detection-system
- Repository: https://github.com/jayantuppal/intrusion-detection-system

## Overview

##### Project type and purpose
- This is a machine-learning based Intrusion Detection System (IDS) implemented as a Jupyter notebook.
- Its goal is to process the KDD Cup ’99 network traffic dataset, train three classifiers (Decision Tree, Gaussian Naive Bayes, XGBoost), combine them via a voting ensemble, and produce predictions on malicious vs. normal connections.

##### File structure
- Top-level files only:
- IDS.ipynb – the end-to-end notebook containing data-load, preprocessing, EDA, model training, evaluation, and visualization.
- requirements.txt – Python dependencies (scikit-learn, xgboost, pandas, matplotlib, etc.).
- README.md – project overview and usage instructions.
- No separate “src” or “scripts” directories; everything lives in the notebook.

##### Key insights from the README
- Four sequential steps: Load & preprocess data → EDA → Model training → Ensemble classification.
- Technologies: Python, Jupyter, pandas, scikit-learn, XGBoost, matplotlib/seaborn for plots.
- External dependency: KDD dataset file.

##### Main components
a. Data Source
- KDD ’99 dataset (local CSV/GZ file).
b. Data Ingestion & Preprocessing
- Integration, cleaning (remove outliers/duplicates), encoding symbolic → numeric, scaling or normalization.
c. Exploratory Data Analysis (EDA)
- Statistical summaries, visualizations (histograms, boxplots, correlation heatmap).
d. Model Training
- Three parallel classifier modules:
- Decision Tree Trainer
- Gaussian Naive Bayes Trainer
- XGBoost Trainer
- Each module outputs a trained model.
e. Ensemble Module
- Voting aggregator that takes predictions from the three models and outputs final class.
f. Evaluation & Results
- Metrics calculator (accuracy, precision, recall, F1, confusion matrix) and result plots.

##### Architectural patterns/design principles
- Pipeline pattern: data flows through discrete, ordered stages.
- Parallel training sub-pipeline: three independent model pipelines feeding into a single ensemble.
- Separation of concerns: distinct modules for preprocessing, EDA, training, and evaluation.

##### Relevant technologies/frameworks
- Python & Jupyter Notebook environment.
- pandas for data manipulation.
- scikit-learn for Decision Tree & Gaussian NB, metrics.
- xgboost library for the XGBoost classifier.
- matplotlib/seaborn for visualizations.

## Diagram (Mermaid)

```mermaid
flowchart TB
    README["Project Overview & Usage Instructions<br/>(README.md)"]:::external
    Req["Python Dependencies<br/>(requirements.txt)"]:::external
    DS["KDD '99 Dataset<br/>(CSV/GZ)"]:::external
    Pre["Data Ingestion & Preprocessing<br/>(pandas, scikit-learn)"]:::dataStep
    EDA["Exploratory Data Analysis (EDA)<br/>(pandas, matplotlib/seaborn)"]:::dataStep
    DT["Decision Tree Trainer<br/>(scikit-learn)"]:::modelStep
    NB["Gaussian Naive Bayes Trainer<br/>(scikit-learn)"]:::modelStep
    XGB["XGBoost Trainer<br/>(xgboost)"]:::modelStep
    Ensem["Ensemble Voting Aggregator<br/>Voting strategy: majority"]:::ensembleStep
    Eval["Evaluation & Results<br/>(metrics & plots)"]:::evalStep

    README --> Req
    DS --> Pre
    Pre --> EDA
    Pre --> DT
    Pre --> NB
    Pre --> XGB
    DT --> Ensem
    NB --> Ensem
    XGB --> Ensem
    Ensem --> Eval

    click Pre "https://github.com/jayantuppal/intrusion-detection-system/blob/main/IDS.ipynb"
    click EDA "https://github.com/jayantuppal/intrusion-detection-system/blob/main/IDS.ipynb"
    click DT "https://github.com/jayantuppal/intrusion-detection-system/blob/main/IDS.ipynb"
    click NB "https://github.com/jayantuppal/intrusion-detection-system/blob/main/IDS.ipynb"
    click XGB "https://github.com/jayantuppal/intrusion-detection-system/blob/main/IDS.ipynb"
    click Ensem "https://github.com/jayantuppal/intrusion-detection-system/blob/main/IDS.ipynb"
    click Eval "https://github.com/jayantuppal/intrusion-detection-system/blob/main/IDS.ipynb"
    click README "https://github.com/jayantuppal/intrusion-detection-system/blob/main/README.md"
    click Req "https://github.com/jayantuppal/intrusion-detection-system/blob/main/requirements.txt"

    classDef dataStep fill:#aed6f1,stroke:#1f618d,color:#1b2631
    classDef modelStep fill:#abebc6,stroke:#117864,color:#1b2631
    classDef ensembleStep fill:#f9e79f,stroke:#b9770e,color:#1b2631
    classDef evalStep fill:#d7bde2,stroke:#6c3483,color:#1b2631
    classDef external fill:#f5b7b1,stroke:#922b21,color:#1b2631
```
