# chaunceykung/causalmmm architecture

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

- Interactive diagram: https://gitdiagram.com/chaunceykung/causalmmm
- Repository: https://github.com/chaunceykung/causalmmm

## Overview

##### Main Components
- Main Execution Logic: Represented by main.py, which acts as the entry point.
- Configuration Manager: The configs directory (e.g., configs/config01.txt) which holds parameters and settings.
- Data Management: The data directory contains two subdirectories—“real” and “sim” (simulated) datasets. This is where your input data for training and evaluation is stored.
- Data Loading & Preprocessing: loader.py (and possibly parts of utils.py) handling the ingestion, preprocessing, and possibly transformations of the data.
- Model Definition and Forward Propagation: The model directory includes several key modules:
- BaseModules.py: Likely defines basic network components.
- CausalNetworks.py: Implements the causal structure aspects of the network.
- forward_pass.py: Contains the logic for passing data through the model.
- modelInit.py: Responsible for model initialization.
- Supporting Utilities: utils.py, which might cover additional functions such as logging, evaluation metrics, or data handling utilities.

##### Relationships and Interactions
- A connection from the Data Loader to the Data Management node, with branches for both “real” and “sim” datasets.
- Finally, include interactions where utility functions (from utils.py) support various components, perhaps interfacing with both the data preprocessing and model training/evaluation stages.

##### Technical Stack and Patterns
- That the project is built using Python 3 and PyTorch 1.13.1.
- Typical machine learning pipeline pattern:
- Configuration → Data Ingestion → Model Initialization → Data Forward Pass → (Training/Evaluation)
- Recognize that the modular structure in “model” suggests separation of concerns in building neural network components, reinforcing a clear, layered design.

## Diagram (Mermaid)

```mermaid
flowchart TB
    mainExecution["Main Execution (main.py)"]:::script
    configManager["Configuration Manager (configs/configs01.txt)"]:::config
    dataLoader["Data Loader (loader.py)"]:::script

    mainExecution -->|"reads_config"| configManager
    mainExecution -->|"triggers"| dataLoader

    subgraph "Data Management"
        dataReal["Real Data (data/real)"]:::data
        dataSim["Simulated Data (data/sim)"]:::data
    end

    dataLoader -->|"loads_data_from"| dataReal
    dataLoader -->|"loads_data_from"| dataSim
    dataLoader -->|"supplies_data"| modelInit

    subgraph "Model Framework"
        modelInit["Model Initialization (model/modelInit.py)"]:::model
        baseModules["Base Modules (model/BaseModules.py)"]:::model
        causalNetworks["Causal Network Module (model/CausalNetworks.py)"]:::model
        forwardPass["Forward Pass (model/forward_pass.py)"]:::model
    end

    modelInit -->|"initializes"| baseModules
    modelInit -->|"initializes"| causalNetworks
    baseModules -->|"flows_data"| forwardPass
    causalNetworks -->|"flows_data"| forwardPass

    utilities["Utilities (utils.py)"]:::utility
    utilities -->|"supports"| dataLoader
    utilities -->|"supports"| forwardPass

    framework["Framework (Python 3, PyTorch 1.13.1)"]:::external
    mainExecution -->|"built_on"| framework

    classDef script fill:#FFCCCC,stroke:#333,stroke-width:2px;
    classDef config fill:#CCFFCC,stroke:#333,stroke-width:2px;
    classDef data fill:#CCCCFF,stroke:#333,stroke-width:2px;
    classDef model fill:#FFFFCC,stroke:#333,stroke-width:2px;
    classDef utility fill:#CCFFFF,stroke:#333,stroke-width:2px;
    classDef external fill:#FFCC99,stroke:#333,stroke-width:2px;

    click mainExecution "https://github.com/chaunceykung/causalmmm/blob/main/main.py"
    click configManager "https://github.com/chaunceykung/causalmmm/blob/main/configs/configs01.txt"
    click dataReal "https://github.com/chaunceykung/causalmmm/tree/main/data/real"
    click dataSim "https://github.com/chaunceykung/causalmmm/tree/main/data/sim"
    click dataLoader "https://github.com/chaunceykung/causalmmm/blob/main/loader.py"
    click modelInit "https://github.com/chaunceykung/causalmmm/blob/main/model/modelInit.py"
    click baseModules "https://github.com/chaunceykung/causalmmm/blob/main/model/BaseModules.py"
    click causalNetworks "https://github.com/chaunceykung/causalmmm/blob/main/model/CausalNetworks.py"
    click forwardPass "https://github.com/chaunceykung/causalmmm/blob/main/model/forward_pass.py"
    click utilities "https://github.com/chaunceykung/causalmmm/blob/main/utils.py"
```
