# sh7shir/anomaly-labelling architecture

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

- Interactive diagram: https://gitdiagram.com/sh7shir/anomaly-labelling
- Repository: https://github.com/sh7shir/anomaly-labelling

## Overview

This repository supports a three-step anomaly-analysis workflow: format CESNET traffic data, prepare datasets and run offline/online detectors, then inspect results with dataset-specific visualization scripts. The central runtime pairs offline preparation with streaming anomaly scoring; the detector set includes AnDePeD and NAB-derived approaches. Source excerpts establish the main orchestration and selected detector relationships; other capabilities and visualization branches are included where documented, without assuming unsampled implementation details.

Main entry points: [`2_AnDePeD-main/Code/main.py`](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/main.py) (Pipeline runner), [`2_AnDePeD-main/Code/online_use.py`](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/online_use.py) (Online procedure), [`2_AnDePeD-main/Code/OnlineDetectors`](https://github.com/sh7shir/anomaly-labelling/tree/main/2_AnDePeD-main/Code/OnlineDetectors) (Configured detectors), [`3_Result_Visualization`](https://github.com/sh7shir/anomaly-labelling/tree/main/3_Result_Visualization) (Result visualization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_cesnet["CESNET formatter"]
  node_dataset_select["Dataset selection<br/>[data_handler.py]"]
  node_file_io["CSV and labels<br/>[read_files.py]"]
end

subgraph group_runtime["Detection runtime"]
  node_config["Runtime config<br/>[main_config.py]"]
  node_entry["Pipeline runner<br/>[main.py]"]
  node_offline["Offline preparation<br/>[offline_prep.py]"]
  node_optimizer["Parameter optimization<br/>[optimiser.py]"]
  node_online["Online procedure<br/>[online_use.py]"]
  node_buffer["Online buffer<br/>[online_buffer.py]"]
  node_scaling["Value scaling<br/>[scaling.py]"]
  node_vmd["Mode removal<br/>[vmd.py]"]
end

subgraph group_detectors["Detector implementations"]
  node_detector_base["Online detector API"]
  node_detector_families["Configured detectors"]
  node_skyline["Skyline ensemble"]
  node_skyline_algorithms["Skyline algorithms<br/>[algorithms.py]"]
  node_context_detector["Context OSE detector"]
  node_context_cad["Context anomaly engine<br/>[cad_ose.py]"]
  node_context_operator["Context operator"]
  node_nab_base["NAB detector API<br/>[base.py]"]
  node_nab_context["NAB Context OSE"]
  node_nab_cad["NAB context engine<br/>[cad_ose.py]"]
  node_nab_operator["NAB context operator"]
end

subgraph group_analysis["Result analysis"]
  node_results["Online results<br/>[write_files.py]"]
  node_visualization["Result visualization"]
  node_nab_visuals["NAB visualizations"]
  node_cesnet_visuals["CESNET visualizations"]
end

node_user(("Engineer"))

node_user -->|"formats datasets"| node_cesnet
node_cesnet -.->|"prepares detector inputs"| node_dataset_select
node_user -->|"runs pipeline"| node_entry
node_entry -->|"reads settings"| node_config
node_entry -->|"selects datasets"| node_dataset_select
node_entry -->|"runs preparation"| node_offline
node_offline -->|"optimizes parameters"| node_optimizer
node_entry -->|"loads datasets"| node_file_io
node_entry -->|"starts scoring"| node_online
node_online -->|"updates buffer"| node_buffer
node_online -->|"scales values"| node_scaling
node_online -->|"removes modes"| node_vmd
node_online -->|"selects detector"| node_detector_families
node_online -->|"scores timesteps"| node_detector_base
node_detector_families -.->|"includes"| node_skyline
node_skyline -->|"uses algorithms"| node_skyline_algorithms
node_detector_families -.->|"includes"| node_context_detector
node_context_detector -->|"delegates scoring"| node_context_cad
node_context_cad -->|"uses context operator"| node_context_operator
node_entry -->|"exports results"| node_results
node_user -->|"inspects results"| node_visualization
node_visualization -->|"includes NAB views"| node_nab_visuals
node_visualization -->|"includes CESNET views"| node_cesnet_visuals
node_nab_context -->|"extends detector API"| node_nab_base
node_nab_context -->|"delegates scoring"| node_nab_cad
node_nab_cad -->|"uses context operator"| node_nab_operator

click node_cesnet "https://github.com/sh7shir/anomaly-labelling/blob/main/1_data_processng_for_CESNET/script_for_ces_to_nab_format.py"
click node_dataset_select "https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/data_handler.py"
click node_file_io "https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/read_files.py"
click node_config "https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/main_config.py"
click node_entry "https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/main.py"
click node_offline "https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/offline_prep.py"
click node_optimizer "https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/optimiser.py"
click node_online "https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/online_use.py"
click node_buffer "https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/online_buffer.py"
click node_scaling "https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/scaling.py"
click node_vmd "https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/vmd.py"
click node_detector_base "https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/OnlineDetectors/online_nab_detector.py"
click node_detector_families "https://github.com/sh7shir/anomaly-labelling/tree/main/2_AnDePeD-main/Code/OnlineDetectors"
click node_skyline "https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/OnlineDetectors/earthgeckoSkyline/earthgecko_skyline_detector.py"
click node_skyline_algorithms "https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/OnlineDetectors/earthgeckoSkyline/algorithms.py"
click node_context_detector "https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/OnlineDetectors/contextOSE/context_ose_detector.py"
click node_context_cad "https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/OnlineDetectors/contextOSE/cad_ose.py"
click node_context_operator "https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/OnlineDetectors/contextOSE/context_operator.py"
click node_nab_base "https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/NAB/nab/detectors/base.py"
click node_nab_context "https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/NAB/nab/detectors/context_ose/context_ose_detector.py"
click node_nab_cad "https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/NAB/nab/detectors/context_ose/cad_ose.py"
click node_nab_operator "https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/NAB/nab/detectors/context_ose/context_operator.py"
click node_results "https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/write_files.py"
click node_visualization "https://github.com/sh7shir/anomaly-labelling/tree/main/3_Result_Visualization"
click node_nab_visuals "https://github.com/sh7shir/anomaly-labelling/tree/main/3_Result_Visualization/NAB"
click node_cesnet_visuals "https://github.com/sh7shir/anomaly-labelling/tree/main/3_Result_Visualization/CESNET"

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_cesnet,node_dataset_select,node_file_io toneBlue
class node_config,node_entry,node_offline,node_optimizer,node_online,node_buffer,node_scaling,node_vmd toneAmber
class node_detector_base,node_detector_families,node_skyline,node_skyline_algorithms,node_context_detector,node_context_cad,node_context_operator,node_nab_base,node_nab_context,node_nab_cad,node_nab_operator toneMint
class node_results,node_visualization,node_nab_visuals,node_cesnet_visuals toneRose
class node_user toneIndigo
```

## Components

### Data preparation

- [CESNET formatter](https://github.com/sh7shir/anomaly-labelling/blob/main/1_data_processng_for_CESNET/script_for_ces_to_nab_format.py): `1_data_processng_for_CESNET/script_for_ces_to_nab_format.py`
- [Dataset selection](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/data_handler.py): `2_AnDePeD-main/Code/data_handler.py`
- [CSV and labels](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/read_files.py): `2_AnDePeD-main/Code/read_files.py`

### Detection runtime

- [Runtime config](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/main_config.py): `2_AnDePeD-main/Code/main_config.py`
- [Pipeline runner](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/main.py): `2_AnDePeD-main/Code/main.py`
- [Offline preparation](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/offline_prep.py): `2_AnDePeD-main/Code/offline_prep.py`
- [Parameter optimization](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/optimiser.py): `2_AnDePeD-main/Code/optimiser.py`
- [Online procedure](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/online_use.py): `2_AnDePeD-main/Code/online_use.py`
- [Online buffer](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/online_buffer.py): `2_AnDePeD-main/Code/online_buffer.py`
- [Value scaling](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/scaling.py): `2_AnDePeD-main/Code/scaling.py`
- [Mode removal](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/vmd.py): `2_AnDePeD-main/Code/vmd.py`

### Detector implementations

- [Online detector API](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/OnlineDetectors/online_nab_detector.py): `2_AnDePeD-main/Code/OnlineDetectors/online_nab_detector.py`
- [Configured detectors](https://github.com/sh7shir/anomaly-labelling/tree/main/2_AnDePeD-main/Code/OnlineDetectors): `2_AnDePeD-main/Code/OnlineDetectors`
- [Skyline ensemble](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/OnlineDetectors/earthgeckoSkyline/earthgecko_skyline_detector.py): `2_AnDePeD-main/Code/OnlineDetectors/earthgeckoSkyline/earthgecko_skyline_detector.py`
- [Skyline algorithms](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/OnlineDetectors/earthgeckoSkyline/algorithms.py): `2_AnDePeD-main/Code/OnlineDetectors/earthgeckoSkyline/algorithms.py`
- [Context OSE detector](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/OnlineDetectors/contextOSE/context_ose_detector.py): `2_AnDePeD-main/Code/OnlineDetectors/contextOSE/context_ose_detector.py`
- [Context anomaly engine](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/OnlineDetectors/contextOSE/cad_ose.py): `2_AnDePeD-main/Code/OnlineDetectors/contextOSE/cad_ose.py`
- [Context operator](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/OnlineDetectors/contextOSE/context_operator.py): `2_AnDePeD-main/Code/OnlineDetectors/contextOSE/context_operator.py`
- [NAB detector API](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/NAB/nab/detectors/base.py): `2_AnDePeD-main/Code/NAB/nab/detectors/base.py`
- [NAB Context OSE](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/NAB/nab/detectors/context_ose/context_ose_detector.py): `2_AnDePeD-main/Code/NAB/nab/detectors/context_ose/context_ose_detector.py`
- [NAB context engine](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/NAB/nab/detectors/context_ose/cad_ose.py): `2_AnDePeD-main/Code/NAB/nab/detectors/context_ose/cad_ose.py`
- [NAB context operator](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/NAB/nab/detectors/context_ose/context_operator.py): `2_AnDePeD-main/Code/NAB/nab/detectors/context_ose/context_operator.py`

### Result analysis

- [Online results](https://github.com/sh7shir/anomaly-labelling/blob/main/2_AnDePeD-main/Code/write_files.py): `2_AnDePeD-main/Code/write_files.py`
- [Result visualization](https://github.com/sh7shir/anomaly-labelling/tree/main/3_Result_Visualization): `3_Result_Visualization`
- [NAB visualizations](https://github.com/sh7shir/anomaly-labelling/tree/main/3_Result_Visualization/NAB): `3_Result_Visualization/NAB`
- [CESNET visualizations](https://github.com/sh7shir/anomaly-labelling/tree/main/3_Result_Visualization/CESNET): `3_Result_Visualization/CESNET`

### Other components

- **Engineer**

## Connections

- Engineer → CESNET formatter: formats datasets
- CESNET formatter → Dataset selection: prepares detector inputs
- Engineer → Pipeline runner: runs pipeline
- Pipeline runner → Runtime config: reads settings (evidence: `2_AnDePeD-main/Code/main.py`)
- Pipeline runner → Dataset selection: selects datasets (evidence: `2_AnDePeD-main/Code/main.py`)
- Pipeline runner → Offline preparation: runs preparation (evidence: `2_AnDePeD-main/Code/main.py`)
- Offline preparation → Parameter optimization: optimizes parameters (evidence: `2_AnDePeD-main/Code/offline_prep.py`)
- Pipeline runner → CSV and labels: loads datasets (evidence: `2_AnDePeD-main/Code/main.py`)
- Pipeline runner → Online procedure: starts scoring (evidence: `2_AnDePeD-main/Code/main.py`)
- Online procedure → Online buffer: updates buffer (evidence: `2_AnDePeD-main/Code/online_use.py`)
- Online procedure → Value scaling: scales values (evidence: `2_AnDePeD-main/Code/online_use.py`)
- Online procedure → Mode removal: removes modes (evidence: `2_AnDePeD-main/Code/online_use.py`)
- Online procedure → Configured detectors: selects detector (evidence: `2_AnDePeD-main/Code/online_use.py`)
- Online procedure → Online detector API: scores timesteps (evidence: `2_AnDePeD-main/Code/online_use.py`)
- Configured detectors → Skyline ensemble: includes (evidence: `2_AnDePeD-main/Code/OnlineDetectors/earthgeckoSkyline/earthgecko_skyline_detector.py`)
- Skyline ensemble → Skyline algorithms: uses algorithms (evidence: `2_AnDePeD-main/Code/OnlineDetectors/earthgeckoSkyline/earthgecko_skyline_detector.py`)
- Configured detectors → Context OSE detector: includes (evidence: `2_AnDePeD-main/Code/OnlineDetectors/contextOSE/context_ose_detector.py`)
- Context OSE detector → Context anomaly engine: delegates scoring (evidence: `2_AnDePeD-main/Code/OnlineDetectors/contextOSE/context_ose_detector.py`)
- Context anomaly engine → Context operator: uses context operator (evidence: `2_AnDePeD-main/Code/OnlineDetectors/contextOSE/cad_ose.py`)
- Pipeline runner → Online results: exports results (evidence: `2_AnDePeD-main/Code/main.py`)
- Engineer → Result visualization: inspects results
- Result visualization → NAB visualizations: includes NAB views
- Result visualization → CESNET visualizations: includes CESNET views
- NAB Context OSE → NAB detector API: extends detector API (evidence: `2_AnDePeD-main/Code/NAB/nab/detectors/context_ose/context_ose_detector.py`)
- NAB Context OSE → NAB context engine: delegates scoring (evidence: `2_AnDePeD-main/Code/NAB/nab/detectors/context_ose/context_ose_detector.py`)
- NAB context engine → NAB context operator: uses context operator (evidence: `2_AnDePeD-main/Code/NAB/nab/detectors/context_ose/cad_ose.py`)
