# predict-idlab/cct-cmc architecture

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

- Interactive diagram: https://gitdiagram.com/predict-idlab/cct-cmc
- Repository: https://github.com/predict-idlab/cct-cmc

## Overview

Key Components to Include:

##### Core Architecture Components

a) Data Layer:
- 'data' directory with two main datasets (IHDP and NLSM)
- Synthetic data generators from src/datasets

b) Model Implementation Layer:
- Three main components under 'src':
- conformal_metalearners (core implementation)
- cmc_metalearners (CMC specific implementation)
- wcp (Weighted Conformal Prediction)

c) Experimentation Layer:
- Notebooks directory containing experimental implementations
- Results directory storing output figures

##### Specific Implementation Details

- Model Components:
- T-Learner
- X-Learner
- S-Learner
- Base ML models (e.g., RandomForestRegressor)

- Processing Flows:
- Training flow
- Prediction flow
- Monte Carlo sampling process
- Conformal calibration process

##### Interaction Patterns

- Data flow between components
- Model training and prediction paths
- Evaluation feedback loops

##### Technical Details

a) Key Methods:
- fit()
- predict_int()
- predict_cps()

b) Configuration Options:
- adaptive_conformal
- pseudo_MC
- MC_samples

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Data
        IHDP["IHDP Dataset"]:::data
        NLSM["NLSM Dataset"]:::data
        SynGen["Synthetic Data Generators"]:::data
        subgraph SynTypes
            Alaa["Alaa Synthetic"]:::data
            NieWager["Nie Wager Synthetic"]:::data
            SemiSyn["Semi Synthetic"]:::data
        end
    end

    subgraph Core
        subgraph CCT["Conformal Metalearners"]
            MetaL["Metalearners"]:::core
            CML["CM Learner"]:::core
            DRL["DR Learner"]:::core
        end
        
        subgraph CMC["CMC Implementation"]
            CMCM["CMC Metalearners"]:::core
        end
        
        WCP["Weighted Conformal Prediction"]:::core
    end

    subgraph Models
        TL["T-Learner"]:::model
        XL["X-Learner"]:::model
        SL["S-Learner"]:::model
        BaseML["Base ML Models"]:::model
    end

    subgraph Experiments
        subgraph SynExp["Synthetic Experiments"]
            NWExp["Nie Wager Comparison"]:::exp
            AlaaExp["Alaa Comparison"]:::exp
        end
        
        subgraph RealExp["Real Data Experiments"]
            SemiExp["Semi-synthetic Analysis"]:::exp
            ACICExp["ACIC2016 Analysis"]:::exp
        end
        
        Analysis["Analysis & Visualization"]:::exp
    end

    subgraph Output
        Results["Results Visualization"]:::output
    end

    %% Data Flow
    IHDP --> CCT
    NLSM --> CCT
    SynGen --> SynTypes
    SynTypes --> Experiments
    
    CCT --> Models
    CMC --> Models
    Models --> Experiments
    WCP --> Experiments
    
    Experiments --> Results

    %% Styling
    classDef data fill:#3498db
    classDef core fill:#2ecc71
    classDef model fill:#95a5a6
    classDef exp fill:#e67e22
    classDef output fill:#9b59b6

    %% Click Events
    click IHDP "https://github.com/predict-idlab/cct-cmc/blob/main/data/IHDP/ihdp_npci_1-100.train.npz"
    click NLSM "https://github.com/predict-idlab/cct-cmc/blob/main/data/NLSM/NLSM_data.csv"
    click Alaa "https://github.com/predict-idlab/cct-cmc/blob/main/src/datasets/alaa_synthetic.py"
    click NieWager "https://github.com/predict-idlab/cct-cmc/blob/main/src/datasets/nie_wager_synthetic.py"
    click SemiSyn "https://github.com/predict-idlab/cct-cmc/blob/main/src/datasets/semi_synthetic.py"
    click MetaL "https://github.com/predict-idlab/cct-cmc/blob/main/src/conformal_metalearners/metalearners.py"
    click CML "https://github.com/predict-idlab/cct-cmc/blob/main/src/conformal_metalearners/CM_learner.py"
    click DRL "https://github.com/predict-idlab/cct-cmc/blob/main/src/conformal_metalearners/drlearner.py"
    click CMCM "https://github.com/predict-idlab/cct-cmc/blob/main/src/cmc_metalearners/cmc_metalearners.py"
    click WCP "https://github.com/predict-idlab/cct-cmc/blob/main/src/wcp/wcp.py"
    click NWExp "https://github.com/predict-idlab/cct-cmc/blob/main/notebooks/experiments/1-sim-comparison-nie-wager-synthetic.ipynb"
    click AlaaExp "https://github.com/predict-idlab/cct-cmc/blob/main/notebooks/experiments/2-sim-comparison-alaa-synthetic.ipynb"
    click SemiExp "https://github.com/predict-idlab/cct-cmc/blob/main/notebooks/experiments/3a-sim-comparison-semi-synthetic.ipynb"
    click ACICExp "https://github.com/predict-idlab/cct-cmc/blob/main/notebooks/experiments/3b-sim-comparison-semi-synthetic-acic2016.ipynb"
    click Analysis "https://github.com/predict-idlab/cct-cmc/blob/main/notebooks/experiments/4-sim-epsilon-analysis.ipynb"
    click Results "https://github.com/predict-idlab/cct-cmc/tree/main/results/figures/"
```
