# mervesudeboler/neuralsentinel-ids architecture

> Architecture diagram of the GitHub repository mervesudeboler/neuralsentinel-ids, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mervesudeboler/neuralsentinel-ids
- Repository: https://github.com/mervesudeboler/neuralsentinel-ids

## Overview

NeuralSentinel-IDS preprocesses NSL-KDD traffic, trains a residual IDS alongside an adversarial traffic generator, then hardens and evaluates the IDS. A separate detection command streams test-set samples through the trained model and records alerts and packet counts for the live dashboard. The graph includes documented ensemble and reporting capabilities; dashboard internals were not sampled, so its connections rely on README statements.

Main entry points: [`train.py`](https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/train.py) (Training Pipeline), [`evaluate.py`](https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/evaluate.py) (Evaluation Reports), [`detect.py`](https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/detect.py) (Live Detection Stream), [`src/data/preprocessor.py`](https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/src/data/preprocessor.py) (Data Preprocessor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Data and Workflow"]
  node_train["Training Pipeline<br/>[train.py]"]
  node_preprocessor["Data Preprocessor<br/>[preprocessor.py]"]
  node_trainer["Adversarial Trainer<br/>[trainer.py]"]
end

subgraph group_models["Detection and GAN"]
  node_generator["Attention Generator<br/>[generator.py]"]
  node_neural_ids["Residual Neural IDS<br/>[models.py]"]
  node_ensemble["Soft-Voting Ensemble<br/>[models.py]"]
end

subgraph group_operations["Runtime Operations"]
  node_detect["Live Detection Stream<br/>[detect.py]"]
  node_evaluate["Evaluation Reports<br/>[evaluate.py]"]
end

subgraph group_monitoring["Monitoring and Results"]
  node_tracker["Metrics Tracker<br/>[logger.py]"]
  node_dashboard["Live Dashboard<br/>[app.py]"]
  node_reports["Evaluation Outputs<br/>[evaluate.py]"]
end

node_user(("Operator"))
node_dataset[("NSL-KDD")]

node_user -->|"starts training"| node_train
node_train -->|"loads and splits"| node_preprocessor
node_preprocessor -->|"downloads and reads"| node_dataset
node_train -->|"pretrains IDS"| node_neural_ids
node_train -->|"configures"| node_generator
node_train -->|"runs phases"| node_trainer
node_trainer -->|"trains and samples"| node_generator
node_trainer -->|"scores and hardens"| node_neural_ids
node_train -->|"trains baseline"| node_ensemble
node_user -->|"starts stream"| node_detect
node_detect -->|"loads test data"| node_preprocessor
node_detect -->|"classifies samples"| node_neural_ids
node_detect -->|"records packets and alerts"| node_tracker
node_user -->|"opens dashboard"| node_dashboard
node_tracker -->|"supplies live metrics"| node_dashboard
node_user -->|"runs evaluation"| node_evaluate
node_evaluate -->|"loads test data"| node_preprocessor
node_evaluate -->|"evaluates IDS"| node_neural_ids
node_evaluate -->|"tests evasion"| node_generator
node_evaluate -->|"writes report"| node_reports

click node_train "https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/train.py"
click node_preprocessor "https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/src/data/preprocessor.py"
click node_trainer "https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/src/gan/trainer.py"
click node_generator "https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/src/gan/generator.py"
click node_neural_ids "https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/src/ids/models.py"
click node_ensemble "https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/src/ids/models.py"
click node_detect "https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/detect.py"
click node_evaluate "https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/evaluate.py"
click node_tracker "https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/src/utils/logger.py"
click node_dashboard "https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/src/dashboard/app.py"
click node_reports "https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/evaluate.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_train,node_preprocessor,node_trainer toneBlue
class node_generator,node_neural_ids,node_ensemble,node_dataset toneAmber
class node_detect,node_evaluate toneMint
class node_tracker,node_dashboard,node_reports toneRose
class node_user toneIndigo
```

## Components

### Data and Workflow

- [Training Pipeline](https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/train.py): `train.py`
- [Data Preprocessor](https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/src/data/preprocessor.py): `src/data/preprocessor.py`
- [Adversarial Trainer](https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/src/gan/trainer.py): `src/gan/trainer.py`

### Detection and GAN

- [Attention Generator](https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/src/gan/generator.py): `src/gan/generator.py`
- [Residual Neural IDS](https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/src/ids/models.py): `src/ids/models.py`
- [Soft-Voting Ensemble](https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/src/ids/models.py): `src/ids/models.py`

### Runtime Operations

- [Live Detection Stream](https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/detect.py): `detect.py`
- [Evaluation Reports](https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/evaluate.py): `evaluate.py`

### Monitoring and Results

- [Metrics Tracker](https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/src/utils/logger.py): `src/utils/logger.py`
- [Live Dashboard](https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/src/dashboard/app.py): `src/dashboard/app.py`
- [Evaluation Outputs](https://github.com/mervesudeboler/neuralsentinel-ids/blob/main/evaluate.py): `evaluate.py`

### Other components

- **Operator**
- **NSL-KDD**

## Connections

- Operator → Training Pipeline: starts training (evidence: `README.md`)
- Training Pipeline → Data Preprocessor: loads and splits (evidence: `train.py`)
- Data Preprocessor → NSL-KDD: downloads and reads (evidence: `README.md`)
- Training Pipeline → Residual Neural IDS: pretrains IDS (evidence: `train.py`)
- Training Pipeline → Attention Generator: configures (evidence: `train.py`)
- Training Pipeline → Adversarial Trainer: runs phases (evidence: `train.py`)
- Adversarial Trainer → Attention Generator: trains and samples (evidence: `src/gan/trainer.py`)
- Adversarial Trainer → Residual Neural IDS: scores and hardens (evidence: `src/gan/trainer.py`)
- Training Pipeline → Soft-Voting Ensemble: trains baseline (evidence: `train.py`)
- Operator → Live Detection Stream: starts stream (evidence: `README.md`)
- Live Detection Stream → Data Preprocessor: loads test data (evidence: `detect.py`)
- Live Detection Stream → Residual Neural IDS: classifies samples (evidence: `detect.py`)
- Live Detection Stream → Metrics Tracker: records packets and alerts (evidence: `detect.py`)
- Operator → Live Dashboard: opens dashboard (evidence: `README.md`)
- Metrics Tracker → Live Dashboard: supplies live metrics (evidence: `README.md`)
- Operator → Evaluation Reports: runs evaluation (evidence: `README.md`)
- Evaluation Reports → Data Preprocessor: loads test data (evidence: `evaluate.py`)
- Evaluation Reports → Residual Neural IDS: evaluates IDS (evidence: `evaluate.py`)
- Evaluation Reports → Attention Generator: tests evasion (evidence: `evaluate.py`)
- Evaluation Reports → Evaluation Outputs: writes report (evidence: `README.md`)
