# vitural2904/ics_anomaly_detection_machine_learning architecture

> Architecture diagram of the GitHub repository vitural2904/ics_anomaly_detection_machine_learning, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vitural2904/ics_anomaly_detection_machine_learning
- Repository: https://github.com/vitural2904/ics_anomaly_detection_machine_learning

## Overview

##### Project type and purpose
- This is a batch-style machine learning pipeline for anomaly detection in Industrial Control Systems (ICS).
- It ingests time-series CSV data (normal and attack scenarios), scales it, trains a model (e.g., Ridge regression), tunes hyperparameters, and evaluates on test sets.

##### File structure
- data/ – Raw datasets (train and various test CSVs).
- scaler/ – Serialized preprocessing artifact (training_scaler.save).
- src/loader – Component to load CSVs into memory (data_loader.py).
- src/train_model – Core training logic that fits the model and saves it.
- src/hyperparameter_tuning – Module to search for optimal hyperparameters.
- src/test_dataset_eval – Evaluation harness that applies the saved model to test sets and writes metrics.
- src/result – Directory where evaluation output (e.g., Ridge.txt) is stored.

##### README
- Minimal contents, but the project name (“ics_anomaly_detection_machine_learning”) confirms focus on ICS anomaly detection via ML.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Training Phase"
        rawData["Raw CSV Data"]:::data
        loader["Data Loader"]:::compute
        preproc["Preprocessor / Scaler"]:::compute
        scalerStore["Scaler Artifact"]:::storage
        trainer["Model Training"]:::compute
        tuner["Hyperparameter Tuning"]:::compute
        modelStore["Model Artifact Store"]:::storage
    end

    subgraph "Evaluation Phase"
        evalHarness["Evaluation Harness"]:::compute
        evalResults["Evaluation Results"]:::storage
    end

    rawData -->|"CSV files"| loader
    loader -->|"DataFrame"| preproc
    preproc -->|"scaled DataFrame"| trainer
    preproc -->|"scaled DataFrame"| tuner
    trainer -->|"trained model"| modelStore
    preproc -->|"scaler object"| scalerStore
    tuner -->|"parameters"| trainer
    modelStore -->|"model & scaler files"| evalHarness
    scalerStore -->|"scaler file"| evalHarness
    evalHarness -->|"metrics"| evalResults

    click rawData "https://github.com/vitural2904/ics_anomaly_detection_machine_learning/tree/main/data/BATADAL/"
    click loader "https://github.com/vitural2904/ics_anomaly_detection_machine_learning/blob/main/src/loader/data_loader.py"
    click scalerStore "https://github.com/vitural2904/ics_anomaly_detection_machine_learning/blob/main/scaler/training_scaler.save"
    click trainer "https://github.com/vitural2904/ics_anomaly_detection_machine_learning/blob/main/src/train_model/train_model.py"
    click tuner "https://github.com/vitural2904/ics_anomaly_detection_machine_learning/blob/main/src/hyperparameter_tuning/hyperparameter_tuning.py"
    click modelStore "https://github.com/vitural2904/ics_anomaly_detection_machine_learning/tree/main/scaler/"
    click evalHarness "https://github.com/vitural2904/ics_anomaly_detection_machine_learning/blob/main/src/test_dataset_eval/main_eval.py"
    click evalResults "https://github.com/vitural2904/ics_anomaly_detection_machine_learning/blob/main/src/result/testing/Ridge.txt"

    classDef data fill:#00f,stroke:#000,color:#fff
    classDef compute fill:#0f0,stroke:#000,color:#fff
    classDef storage fill:#f90,stroke:#000,color:#000
```
