# ivoafonsobispo/xai-cybersecurity architecture

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

- Interactive diagram: https://gitdiagram.com/ivoafonsobispo/xai-cybersecurity
- Repository: https://github.com/ivoafonsobispo/xai-cybersecurity

## Overview

##### Project type and purpose
- This is a research­-oriented Machine Learning pipeline for an Explainable AI Intrusion Detection System (IDS).
- It is not a standard client-server application, but a data science workflow with distinct phases: datasets ingestion, pre-modeling (EDA, feature engineering), modeling (training, evaluation, saving), and explainability (feature importance, individual prediction, other XAI techniques).

##### File structure
- Top-level directories:
- 0_Datasets – raw input data
- 1_Pre-Modeling_Phase – data exploration, feature engineering, preprocessing
- 2_Modeling_Phase – training, evaluation, old models, saved model artifacts
- 3_Explainable_Phase – various XAI analyses (feature importance, individual predictions, other libraries)
- Many Jupyter notebooks indicate a sequential pipeline rather than microservices or MVC.

##### README for additional insights
- The Experimental Workflow image describes the high-level flow: ingestion → pre-modeling → modeling → explainable.
- Technologies implied: Python, Jupyter, scikit-learn, XGBoost, TensorFlow/Keras, SHAP/LIME, Fairlearn, AIF360, etc.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Ingestion
    Datasets[(Datasets)]:::data
    click Datasets "https://github.com/ivoafonsobispo/xai-cybersecurity/tree/main/0_Datasets"

    %% Pre-Modeling Phase
    subgraph "Pre-Modeling Phase"
        direction TB
        EDA["EDA & Visualization"]:::data
        FE["Feature Engineering"]:::data
        PP["Preprocessing"]:::data
    end
    click EDA "https://github.com/ivoafonsobispo/xai-cybersecurity/tree/main/1_Pre-Modeling_Phase/Data_Analysis"
    click FE "https://github.com/ivoafonsobispo/xai-cybersecurity/tree/main/1_Pre-Modeling_Phase/Feature_Engineering"
    click PP "https://github.com/ivoafonsobispo/xai-cybersecurity/blob/main/1_Pre-Modeling_Phase/CICIDS-2017.ipynb"

    %% Modeling Phase
    subgraph "Modeling Phase"
        direction TB
        MT["Model Training"]:::modeling
        ME["Model Evaluation"]:::modeling
        OM["Old Models"]:::modeling
        SM["Saved Models"]:::modeling
    end
    click MT "https://github.com/ivoafonsobispo/xai-cybersecurity/tree/main/2_Modeling_Phase"
    click OM "https://github.com/ivoafonsobispo/xai-cybersecurity/tree/main/2_Modeling_Phase/Old_Models"
    click SM "https://github.com/ivoafonsobispo/xai-cybersecurity/tree/main/2_Modeling_Phase/Saved_Models"

    %% Explainable Phase
    subgraph "Explainable Phase"
        direction TB
        FI["Feature Importance"]:::explain
        IP["Individual Prediction Explanations"]:::explain
        subgraph "Other XAI Techniques"
            direction TB
            BM["Bias Mitigation"]:::explain
            CF["Counterfactuals"]:::explain
            DB["Dashboards"]:::explain
            EL["Explanatory Libraries"]:::explain
            VL["Visual Libraries"]:::explain
            UL["Unused/Experimental"]:::explain
        end
    end
    click FI "https://github.com/ivoafonsobispo/xai-cybersecurity/tree/main/3_Explainable_Phase/Feature_Importance"
    click IP "https://github.com/ivoafonsobispo/xai-cybersecurity/tree/main/3_Explainable_Phase/Individual_Prediction"
    click BM "https://github.com/ivoafonsobispo/xai-cybersecurity/tree/main/3_Explainable_Phase/Other_XAI_Techniques/Bias_Mitigation_Libraries"
    click CF "https://github.com/ivoafonsobispo/xai-cybersecurity/tree/main/3_Explainable_Phase/Other_XAI_Techniques/Counterfactual_Libraries"
    click DB "https://github.com/ivoafonsobispo/xai-cybersecurity/tree/main/3_Explainable_Phase/Other_XAI_Techniques/Dashboard_Libraries"
    click EL "https://github.com/ivoafonsobispo/xai-cybersecurity/tree/main/3_Explainable_Phase/Other_XAI_Techniques/Explanatory_Libraries"
    click VL "https://github.com/ivoafonsobispo/xai-cybersecurity/tree/main/3_Explainable_Phase/Other_XAI_Techniques/Visual_Libraries"
    click UL "https://github.com/ivoafonsobispo/xai-cybersecurity/tree/main/3_Explainable_Phase/Other_XAI_Techniques/Unused_Libraries"

    %% Outputs
    subgraph "Outputs & Reports"
        direction TB
        WF["Workflow Diagram"]:::outputs
        RM["Project README"]:::outputs
        GI["Generated Images & Charts"]:::outputs
    end
    click WF "https://github.com/ivoafonsobispo/xai-cybersecurity/blob/main/Assets/Experimental-Workflow.png"
    click RM "https://github.com/ivoafonsobispo/xai-cybersecurity/blob/main/README.md"

    %% Flow Arrows
    Datasets -->|"Raw Data"| EDA
    EDA -->|"Insights"| PP
    PP -->|"Features"| FE
    FE -->|"Feature Set"| MT
    MT -->|"Trained Model"| ME
    ME -->|"Evaluation Metrics"| OM
    OM -->|"Versioned Models"| SM
    SM -->|"Final Models"| FI
    SM -->|"Final Models"| IP
    SM -->|"Final Models"| BM
    FI -->|"SHAP/LIME Values"| GI
    IP -->|"Local Explanations"| GI
    UL -->|"Experimental Outputs"| GI
    GI -->|"Reports & Visuals"| WF
    WF -->|"Documentation"| RM

    %% Styles
    classDef data fill:#blue,stroke:#000,color:#fff;
    classDef modeling fill:#0f0,stroke:#000,color:#000;
    classDef explain fill:#ffa500,stroke:#000,color:#000;
    classDef outputs fill:#999,stroke:#000,color:#fff;
```
