# med-djebbi/anomaly-detection-model-in-iot-systems architecture

> Architecture diagram of the GitHub repository med-djebbi/anomaly-detection-model-in-iot-systems, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/med-djebbi/anomaly-detection-model-in-iot-systems
- Repository: https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems

## Overview

This repository appears to implement time-series anomaly detection for industrial sensor data, with WADI data and model variants including GDN, GDN-Transformer, and Anomaly Transformer. The apparent workflow is preparing or loading sensor series, training or running a model, and producing anomaly results. The supplied README is only an LFS pointer, and source excerpts contain no code, so internal connections are shown as unverified rather than asserted; documented capabilities cannot be confirmed from the available README text.

Main entry points: [`main.py`](https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/main.py) (Main runner), [`models/GDN_Transformer.py`](https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/models/GDN_Transformer.py) (GDN Transformer), [`train.py`](https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/train.py) (Training), [`data_factory/data_loader.py`](https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/data_factory/data_loader.py) (Data loading)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_prep_scripts["Dataset processing"]
  node_wadi_data["WADI data"]
  node_time_data["Time-series datasets<br/>[TimeDataset.py]"]
  node_loader["Data loading<br/>[data_loader.py]"]
  node_preprocess["Preprocessing<br/>[preprocess.py]"]
end

subgraph group_runtime["Execution"]
  node_train["Training<br/>[train.py]"]
  node_main["Main runner<br/>[main.py]"]
  node_data_utils["Data utilities<br/>[data.py]"]
  node_io["Input/output<br/>[iostream.py]"]
end

subgraph group_models["Detection models"]
  node_gdn["GDN model<br/>[GDN.py]"]
  node_gdn_transformer["GDN Transformer<br/>[GDN_Transformer.py]"]
  node_anomaly_transformer["Anomaly Transformer"]
end

subgraph group_support["Model components"]
  node_attention["Attention<br/>[attn.py]"]
  node_embeddings["Embeddings<br/>[embed.py]"]
  node_graph_layer["Graph layer<br/>[graph_layer.py]"]
  node_network_structure["Network structure<br/>[net_struct.py]"]
end

node_user(("Research user"))

node_user -.->|"prepares data"| node_prep_scripts
node_user -.->|"trains models"| node_train
node_user -.->|"runs detection"| node_main
node_wadi_data -.->|"supplies data"| node_prep_scripts
node_prep_scripts -.->|"formats series"| node_time_data
node_time_data -.->|"provides samples"| node_loader
node_loader -.->|"prepares batches"| node_preprocess
node_train -.->|"loads data"| node_loader
node_train -.->|"trains model"| node_gdn
node_train -.->|"trains model"| node_gdn_transformer
node_main -.->|"loads data"| node_loader
node_main -.->|"runs model"| node_anomaly_transformer
node_main -.->|"runs model"| node_gdn_transformer
node_main -.->|"handles input/output"| node_io
node_main -.->|"uses utilities"| node_data_utils
node_gdn_transformer -.->|"uses attention"| node_attention
node_gdn_transformer -.->|"uses embeddings"| node_embeddings
node_gdn_transformer -.->|"uses graph layer"| node_graph_layer
node_gdn -.->|"uses graph layer"| node_graph_layer
node_gdn_transformer -.->|"uses structure"| node_network_structure

click node_prep_scripts "https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/tree/master/scripts"
click node_wadi_data "https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/tree/master/data/wadi"
click node_time_data "https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/datasets/TimeDataset.py"
click node_loader "https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/data_factory/data_loader.py"
click node_preprocess "https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/utils/preprocess.py"
click node_train "https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/train.py"
click node_main "https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/main.py"
click node_data_utils "https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/utils/data.py"
click node_io "https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/utils/iostream.py"
click node_gdn "https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/models/GDN.py"
click node_gdn_transformer "https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/models/GDN_Transformer.py"
click node_anomaly_transformer "https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/models/AnomalyTransformer.py"
click node_attention "https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/models/attn.py"
click node_embeddings "https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/models/embed.py"
click node_graph_layer "https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/models/graph_layer.py"
click node_network_structure "https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/utils/net_struct.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_prep_scripts,node_wadi_data,node_time_data,node_loader,node_preprocess,node_user toneBlue
class node_train,node_main,node_data_utils,node_io toneAmber
class node_gdn,node_gdn_transformer,node_anomaly_transformer toneMint
class node_attention,node_embeddings,node_graph_layer,node_network_structure toneRose
```

## Components

### Data preparation

- [Dataset processing](https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/tree/master/scripts): `scripts`
- [WADI data](https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/tree/master/data/wadi): `data/wadi`
- [Time-series datasets](https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/datasets/TimeDataset.py): `datasets/TimeDataset.py`
- [Data loading](https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/data_factory/data_loader.py): `data_factory/data_loader.py`
- [Preprocessing](https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/utils/preprocess.py): `utils/preprocess.py`

### Execution

- [Training](https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/train.py): `train.py`
- [Main runner](https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/main.py): `main.py`
- [Data utilities](https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/utils/data.py): `utils/data.py`
- [Input/output](https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/utils/iostream.py): `utils/iostream.py`

### Detection models

- [GDN model](https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/models/GDN.py): `models/GDN.py`
- [GDN Transformer](https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/models/GDN_Transformer.py): `models/GDN_Transformer.py`
- [Anomaly Transformer](https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/models/AnomalyTransformer.py): `models/AnomalyTransformer.py`

### Model components

- [Attention](https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/models/attn.py): `models/attn.py`
- [Embeddings](https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/models/embed.py): `models/embed.py`
- [Graph layer](https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/models/graph_layer.py): `models/graph_layer.py`
- [Network structure](https://github.com/med-djebbi/anomaly-detection-model-in-iot-systems/blob/master/utils/net_struct.py): `utils/net_struct.py`

### Other components

- **Research user**

## Connections

- Research user → Dataset processing: prepares data
- Research user → Training: trains models
- Research user → Main runner: runs detection
- WADI data → Dataset processing: supplies data
- Dataset processing → Time-series datasets: formats series
- Time-series datasets → Data loading: provides samples
- Data loading → Preprocessing: prepares batches
- Training → Data loading: loads data
- Training → GDN model: trains model
- Training → GDN Transformer: trains model
- Main runner → Data loading: loads data
- Main runner → Anomaly Transformer: runs model
- Main runner → GDN Transformer: runs model
- Main runner → Input/output: handles input/output
- Main runner → Data utilities: uses utilities
- GDN Transformer → Attention: uses attention
- GDN Transformer → Embeddings: uses embeddings
- GDN Transformer → Graph layer: uses graph layer
- GDN model → Graph layer: uses graph layer
- GDN Transformer → Network structure: uses structure
