# hongwei-z/federated-learning-iot-ids architecture

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

- Interactive diagram: https://gitdiagram.com/hongwei-z/federated-learning-iot-ids
- Repository: https://github.com/hongwei-z/federated-learning-iot-ids

## Overview

This repository is an IoT intrusion-detection research pipeline supporting binary and multiclass classification, centralized and federated learning, several model families, and evaluation outputs. The README identifies dataset-preparation notebooks and reports results; the sampled model excerpt shows training, federated aggregation, evaluation, and plotting within one main Python file. The preprocessing notebooks were not sampled, so their exact transformations and connections to the checked-in CSVs are unverified.

Main entry points: [`Federated_IDS_Model.py`](https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/Federated_IDS_Model.py) (Training runner), [`DatasetPreprocessing`](https://github.com/hongwei-z/federated-learning-iot-ids/tree/master/DatasetPreprocessing) (Dataset preprocessing), [`DatasetPreprocessing/dataset_binary.csv`](https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/DatasetPreprocessing/dataset_binary.csv) (Binary dataset), [`DatasetPreprocessing/dataset_multi.csv`](https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/DatasetPreprocessing/dataset_multi.csv) (Multiclass dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_iotdiad[("CIC IoT-DIAD")]
  node_iomt[("CIC IoMT")]
  node_preprocess["Dataset preprocessing"]
  node_binarydata[("Binary dataset<br/>[dataset_binary.csv]")]
  node_multidata[("Multiclass dataset<br/>[dataset_multi.csv]")]
end

subgraph group_training["Model training"]
  node_runner["Training runner"]
  node_kerasmodels["Neural models"]
  node_sklearnmodels["Tree models"]
  node_localtraining["Local training"]
end

subgraph group_federated["Federated learning"]
  node_flclient["Federated client"]
  node_strategy["FedAvg strategy"]
  node_simulation["Federated simulation"]
end

subgraph group_evaluation["Evaluation and results"]
  node_evaluation["Model evaluation"]
  node_reporting["Plots and reports"]
  node_results["Saved results"]
end

node_researcher(("Researcher"))

node_iotdiad -.->|"prepare for"| node_preprocess
node_iomt -.->|"prepare for"| node_preprocess
node_researcher -.->|"selects dataset"| node_preprocess
node_preprocess -.->|"produces"| node_binarydata
node_preprocess -.->|"produces"| node_multidata
node_researcher -->|"configures run"| node_runner
node_binarydata -.->|"trains on"| node_runner
node_multidata -.->|"trains on"| node_runner
node_runner -->|"runs local training"| node_localtraining
node_runner -->|"starts simulation"| node_simulation
node_runner -->|"evaluates model"| node_evaluation
node_runner -->|"plots metrics"| node_reporting
node_localtraining -->|"creates"| node_kerasmodels
node_localtraining -->|"creates"| node_sklearnmodels
node_simulation -->|"dispatches clients"| node_flclient
node_simulation -->|"uses strategy"| node_strategy
node_flclient -->|"trains model"| node_kerasmodels
node_strategy -->|"aggregates updates"| node_flclient
node_reporting -->|"saves plots"| node_results

click node_preprocess "https://github.com/hongwei-z/federated-learning-iot-ids/tree/master/DatasetPreprocessing"
click node_binarydata "https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/DatasetPreprocessing/dataset_binary.csv"
click node_multidata "https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/DatasetPreprocessing/dataset_multi.csv"
click node_runner "https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/Federated_IDS_Model.py"
click node_kerasmodels "https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/Federated_IDS_Model.py"
click node_sklearnmodels "https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/Federated_IDS_Model.py"
click node_localtraining "https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/Federated_IDS_Model.py"
click node_flclient "https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/Federated_IDS_Model.py"
click node_strategy "https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/Federated_IDS_Model.py"
click node_simulation "https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/Federated_IDS_Model.py"
click node_evaluation "https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/Federated_IDS_Model.py"
click node_reporting "https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/Federated_IDS_Model.py"
click node_results "https://github.com/hongwei-z/federated-learning-iot-ids/tree/master/Results"

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_iotdiad,node_iomt,node_preprocess,node_binarydata,node_multidata toneBlue
class node_runner,node_kerasmodels,node_sklearnmodels,node_localtraining toneAmber
class node_flclient,node_strategy,node_simulation toneMint
class node_evaluation,node_reporting,node_results toneRose
class node_researcher toneIndigo
```

## Components

### Data preparation

- **CIC IoT-DIAD**
- **CIC IoMT**
- [Dataset preprocessing](https://github.com/hongwei-z/federated-learning-iot-ids/tree/master/DatasetPreprocessing): `DatasetPreprocessing`
- [Binary dataset](https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/DatasetPreprocessing/dataset_binary.csv): `DatasetPreprocessing/dataset_binary.csv`
- [Multiclass dataset](https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/DatasetPreprocessing/dataset_multi.csv): `DatasetPreprocessing/dataset_multi.csv`

### Model training

- [Training runner](https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/Federated_IDS_Model.py): `Federated_IDS_Model.py`
- [Neural models](https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/Federated_IDS_Model.py): `Federated_IDS_Model.py`
- [Tree models](https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/Federated_IDS_Model.py): `Federated_IDS_Model.py`
- [Local training](https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/Federated_IDS_Model.py): `Federated_IDS_Model.py`

### Federated learning

- [Federated client](https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/Federated_IDS_Model.py): `Federated_IDS_Model.py`
- [FedAvg strategy](https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/Federated_IDS_Model.py): `Federated_IDS_Model.py`
- [Federated simulation](https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/Federated_IDS_Model.py): `Federated_IDS_Model.py`

### Evaluation and results

- [Model evaluation](https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/Federated_IDS_Model.py): `Federated_IDS_Model.py`
- [Plots and reports](https://github.com/hongwei-z/federated-learning-iot-ids/blob/master/Federated_IDS_Model.py): `Federated_IDS_Model.py`
- [Saved results](https://github.com/hongwei-z/federated-learning-iot-ids/tree/master/Results): `Results`

### Other components

- **Researcher**

## Connections

- CIC IoT-DIAD → Dataset preprocessing: prepare for
- CIC IoMT → Dataset preprocessing: prepare for
- Researcher → Dataset preprocessing: selects dataset
- Dataset preprocessing → Binary dataset: produces
- Dataset preprocessing → Multiclass dataset: produces
- Researcher → Training runner: configures run (evidence: `README.md`)
- Binary dataset → Training runner: trains on
- Multiclass dataset → Training runner: trains on
- Training runner → Local training: runs local training (evidence: `Federated_IDS_Model.py`)
- Training runner → Federated simulation: starts simulation (evidence: `Federated_IDS_Model.py`)
- Training runner → Model evaluation: evaluates model (evidence: `Federated_IDS_Model.py`)
- Training runner → Plots and reports: plots metrics (evidence: `Federated_IDS_Model.py`)
- Local training → Neural models: creates (evidence: `Federated_IDS_Model.py`)
- Local training → Tree models: creates (evidence: `Federated_IDS_Model.py`)
- Federated simulation → Federated client: dispatches clients (evidence: `Federated_IDS_Model.py`)
- Federated simulation → FedAvg strategy: uses strategy (evidence: `Federated_IDS_Model.py`)
- Federated client → Neural models: trains model (evidence: `Federated_IDS_Model.py`)
- FedAvg strategy → Federated client: aggregates updates (evidence: `Federated_IDS_Model.py`)
- Plots and reports → Saved results: saves plots (evidence: `Federated_IDS_Model.py`)
