# echkidieu1102/ca-gcn architecture

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

- Interactive diagram: https://gitdiagram.com/echkidieu1102/ca-gcn
- Repository: https://github.com/echkidieu1102/ca-gcn

## Overview

##### Main Components
- Data Layer: Represent the datasets organized under the “data” directory, which include multiple knowledge graph datasets with associated entity/relation mappings, training/validation/test splits, and even historical sequence information (especially for ICEWS14).
- Data Preprocessing / History Extraction: Highlight the role of scripts such as “get_history_record.py”, which likely parse and prepare historical sequence data from the datasets before training/inference.
- Model Definition and Core Engine: Capture key modules in the “rgcn” directory (which includes files like knowledge_graph.py, layers.py, and model.py) and the complementary implementation files in the “src” folder (main.py, model.py, rrgcn.py). These collectively build and define the CA-GCN model.
- Training / Inference Pipeline: Mark out the entry point “src/main.py” as the orchestrator that leverages the model definitions, processes input data, triggers training routines, and eventually carries out evaluation.
- Output and Logging: Include “models” (where trained models are saved) and “logs” (which contain log files for different datasets such as ICEWS18 and WIKI), representing the system’s output and monitoring components.

- From the preprocessing component, indicate that prepared data is fed into the training/inference pipeline (via src/main.py) which interacts with the model component (the GCN modules found in “rgcn” and “src”).

##### Architectural Patterns
- Modularity: The separation of concerns is clear—data management (file structure under “data”), model definition (inside “rgcn” and “src”), and pipeline management (main.py, logs, and models).
- The design follows a typical research/experimental ML architecture with a distinct training loop, model evaluation, and logging processes.
- There is also evidence of temporal or dynamic information handling given the extensive set of historical sequence files.

##### Technologies and Frameworks (as relevant)
- Although not explicitly specified, you might note that the project is likely built with Python and possibly leverages PyTorch or TensorFlow for neural network operations (this is common in such research code).
- The use of npz files suggests that NumPy is used extensively for data storage or preprocessed arrays.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Layer Subgraph
    subgraph "Data Layer (KG Datasets)"
        D1["data/ICEWS14"]
        D2["data/ICEWS18"]
        D3["data/WIKI"]
        D4["data/YAGO"]
        D5["data/GDELT"]
    end

    %% Preprocessing & History Extraction Subgraph
    subgraph "Preprocessing & History Extraction"
        P1["get_history_record.py"]
        P2["data/ICEWS14/history_seq"]
    end

    %% GCN Model Engine Subgraph
    subgraph "GCN Model Engine"
        M1["rgcn/knowledge_graph.py"]
        M2["rgcn/layers.py"]
        M3["rgcn/model.py"]
        M4["rgcn/utils.py"]
        M5["src/model.py"]
        M6["src/rrgcn.py"]
    end

    %% Training / Inference Pipeline
    T1["src/main.py"]

    %% Output and Logging Subgraph
    subgraph "Output and Logging"
        O1["models/"]
        O2["logs/"]
    end

    %% Connections
    D1 --> P1
    D2 --> P1
    D3 --> P1
    D4 --> P1
    D5 --> P1

    P1 --> T1
    P2 --> T1

    T1 -->|"uses"| M1
    T1 -->|"uses"| M2
    T1 -->|"uses"| M3
    T1 -->|"uses"| M4
    T1 -->|"uses"| M5
    T1 -->|"uses"| M6

    T1 --> O1
    T1 --> O2

    %% Styles
    classDef dataLayer fill:#f9c74f,stroke:#000,stroke-width:2px;
    classDef preprocessing fill:#90be6d,stroke:#000,stroke-width:2px;
    classDef modelEngine fill:#577590,stroke:#000,stroke-width:2px;
    classDef training fill:#f94144,stroke:#000,stroke-width:2px;
    classDef output fill:#277da1,stroke:#000,stroke-width:2px;

    class D1,D2,D3,D4,D5 dataLayer;
    class P1,P2 preprocessing;
    class M1,M2,M3,M4,M5,M6 modelEngine;
    class T1 training;
    class O1,O2 output;

    %% Click Events
    click D1 "https://github.com/echkidieu1102/ca-gcn/tree/main/data/ICEWS14"
    click D2 "https://github.com/echkidieu1102/ca-gcn/tree/main/data/ICEWS18"
    click D3 "https://github.com/echkidieu1102/ca-gcn/tree/main/data/WIKI"
    click D4 "https://github.com/echkidieu1102/ca-gcn/tree/main/data/YAGO"
    click D5 "https://github.com/echkidieu1102/ca-gcn/tree/main/data/GDELT"
    click P1 "https://github.com/echkidieu1102/ca-gcn/blob/main/get_history_record.py"
    click P2 "https://github.com/echkidieu1102/ca-gcn/tree/main/data/ICEWS14/history_seq"
    click M1 "https://github.com/echkidieu1102/ca-gcn/blob/main/rgcn/knowledge_graph.py"
    click M2 "https://github.com/echkidieu1102/ca-gcn/blob/main/rgcn/layers.py"
    click M3 "https://github.com/echkidieu1102/ca-gcn/blob/main/rgcn/model.py"
    click M4 "https://github.com/echkidieu1102/ca-gcn/blob/main/rgcn/utils.py"
    click M5 "https://github.com/echkidieu1102/ca-gcn/blob/main/src/model.py"
    click M6 "https://github.com/echkidieu1102/ca-gcn/blob/main/src/rrgcn.py"
    click T1 "https://github.com/echkidieu1102/ca-gcn/blob/main/src/main.py"
    click O1 "https://github.com/echkidieu1102/ca-gcn/tree/main/models/"
    click O2 "https://github.com/echkidieu1102/ca-gcn/tree/main/logs/"
```
