# shifaa174/cse-516--pgm_healthcare_brca architecture

> Architecture diagram of the GitHub repository shifaa174/cse-516--pgm_healthcare_brca, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shifaa174/cse-516--pgm_healthcare_brca
- Repository: https://github.com/shifaa174/cse-516--pgm_healthcare_brca

## Overview

This research repository studies multimodal TCGA-BRCA survival prediction. The principal workflow loads genomic and histology features with survival labels, fits probabilistic CCA using either CCA-based or EM learning, infers latent representations, and evaluates survival risk with a Cox model and C-index. Separate reference code provides CCA variants and simulations; the BRCA reference pipeline and milestone code preserve additional prediction and analysis work. The graph centers on the sampled M2 implementation; M4 and legacy components are included where documented or indexed. Unsampled internals are represented conservatively.

Main entry points: [`M2_G02/Code/src/run_experiments.py`](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M2_G02/Code/src/run_experiments.py) (M2 experiments), [`M2_G02/Code/src/survival.py`](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M2_G02/Code/src/survival.py) (Cox survival), [`M2_G02/Code/src/sweep_latent_dim.py`](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M2_G02/Code/src/sweep_latent_dim.py) (Latent dimension sweep), [`M3_G02/Code/src/run_robustness.py`](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M3_G02/Code/src/run_robustness.py) (M3 robustness)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["BRCA data"]
  node_m2_data["Fold loading<br/>[data.py]"]
  node_m4_data["M4 fold loading<br/>[data.py]"]
  node_brca_loader_a["Prediction data<br/>[dataloader.py]"]
  node_brca_analysis_loader["Analysis data<br/>[dataloader.py]"]
  node_brca_survival_loader["Survival data<br/>[dataloader.py]"]
end

subgraph group_models["Latent models"]
  node_pcca["Probabilistic CCA<br/>[pcca.py]"]
  node_m4_pcca["M4 PCCA<br/>[pcca.py]"]
  node_cca_methods["CCA methods<br/>[cca.m]"]
  node_sparse_cca["Sparse CCA<br/>[sparse_cca.m]"]
  node_graph_cca["Graph CCA<br/>[gn_scca.m]"]
  node_deflation["Deflation methods"]
end

subgraph group_evaluation["Survival evaluation"]
  node_survival["Cox survival<br/>[survival.py]"]
  node_m4_survival["M4 survival<br/>[survival.py]"]
  node_brca_cox["Reference Cox runs<br/>[run_coxph_final.py]"]
  node_brca_analysis["Result utilities<br/>[utils.py]"]
end

subgraph group_research["Experiments and analysis"]
  node_m2_experiments["M2 experiments<br/>[run_experiments.py]"]
  node_m2_sweep["Latent dimension sweep"]
  node_m2_baseline["Paper baseline<br/>[paper_baseline.py]"]
  node_m3_robustness["M3 robustness<br/>[run_robustness.py]"]
  node_m4_experiments["M4 experiments<br/>[run_experiments.py]"]
  node_m4_robustness["M4 robustness<br/>[run_robustness.py]"]
  node_prob_quality["Posterior quality"]
  node_sim_basic["Basic simulations"]
  node_sim_sparse["Sparse simulations"]
  node_sim_graph["Graph simulations"]
end

node_researcher(("Researcher"))

node_researcher -->|"runs"| node_m2_experiments
node_m2_experiments -->|"loads folds"| node_m2_data
node_m2_experiments -->|"fits model"| node_pcca
node_m2_experiments -->|"scores risk"| node_survival
node_m2_sweep -->|"loads folds"| node_m2_data
node_m2_sweep -->|"fits candidates"| node_pcca
node_m2_sweep -->|"scores candidates"| node_survival
node_m2_baseline -->|"uses survival"| node_survival
node_m3_robustness -->|"loads folds"| node_m2_data
node_m3_robustness -->|"fits model"| node_pcca
node_m3_robustness -->|"scores risk"| node_survival
node_m4_experiments -->|"loads folds"| node_m4_data
node_m4_experiments -->|"fits model"| node_m4_pcca
node_m4_experiments -->|"scores risk"| node_m4_survival
node_m4_robustness -->|"loads folds"| node_m4_data
node_m4_robustness -->|"fits model"| node_m4_pcca
node_m4_robustness -->|"scores risk"| node_m4_survival
node_brca_cox -->|"loads dataset"| node_brca_loader_a
node_brca_cox -.->|"uses CCA baseline"| node_cca_methods
node_researcher -.->|"uses reference"| node_cca_methods
node_researcher -.->|"uses reference"| node_sparse_cca
node_researcher -.->|"uses reference"| node_graph_cca
node_researcher -.->|"runs simulations"| node_sim_basic
node_researcher -.->|"runs simulations"| node_sim_sparse
node_researcher -.->|"runs simulations"| node_sim_graph

click node_m2_experiments "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M2_G02/Code/src/run_experiments.py"
click node_m2_data "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M2_G02/Code/src/data.py"
click node_pcca "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M2_G02/Code/src/pcca.py"
click node_survival "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M2_G02/Code/src/survival.py"
click node_m2_sweep "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M2_G02/Code/src/sweep_latent_dim.py"
click node_m2_baseline "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M2_G02/Code/src/paper_baseline.py"
click node_m3_robustness "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M3_G02/Code/src/run_robustness.py"
click node_m4_experiments "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M4_G02/Code/src/run_experiments.py"
click node_m4_pcca "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M4_G02/Code/src/pcca.py"
click node_m4_data "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M4_G02/Code/src/data.py"
click node_m4_survival "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M4_G02/Code/src/survival.py"
click node_m4_robustness "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M4_G02/Code/src/run_robustness.py"
click node_prob_quality "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M4_G02/Code/src/probability_quality.py"
click node_brca_loader_a "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/03_brca/A_survival_prediction/dataloader.py"
click node_brca_cox "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/03_brca/A_survival_prediction/run_coxph_final.py"
click node_brca_analysis_loader "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/03_brca/B_analyse_results/dataloader.py"
click node_brca_analysis "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/03_brca/B_analyse_results/utils.py"
click node_brca_survival_loader "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/03_brca/C_survival_analysis/dataloader.py"
click node_cca_methods "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/01_methods/cca/cca.m"
click node_sparse_cca "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/01_methods/group_scca/sparse_cca.m"
click node_graph_cca "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/01_methods/gn_scca/gn_scca.m"
click node_deflation "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/01_methods/deflation/projection_deflation.m"
click node_sim_basic "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/02_simulations/01_K-basic/step1_generate_data_simple.m"
click node_sim_sparse "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/02_simulations/02_K-sparse/step1_generate_data_sparse.m"
click node_sim_graph "https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/02_simulations/03_K-graph/step1_generate_data_graph.m"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_m2_data,node_m4_data,node_brca_loader_a,node_brca_analysis_loader,node_brca_survival_loader toneBlue
class node_pcca,node_m4_pcca,node_cca_methods,node_sparse_cca,node_graph_cca,node_deflation toneAmber
class node_survival,node_m4_survival,node_brca_cox,node_brca_analysis toneMint
class node_m2_experiments,node_m2_sweep,node_m2_baseline,node_m3_robustness,node_m4_experiments,node_m4_robustness,node_prob_quality,node_sim_basic,node_sim_sparse,node_sim_graph toneRose
class node_researcher toneIndigo
```

## Components

### BRCA data

- [Fold loading](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M2_G02/Code/src/data.py): `M2_G02/Code/src/data.py`
- [M4 fold loading](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M4_G02/Code/src/data.py): `M4_G02/Code/src/data.py`
- [Prediction data](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/03_brca/A_survival_prediction/dataloader.py): `03_brca/A_survival_prediction/dataloader.py`
- [Analysis data](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/03_brca/B_analyse_results/dataloader.py): `03_brca/B_analyse_results/dataloader.py`
- [Survival data](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/03_brca/C_survival_analysis/dataloader.py): `03_brca/C_survival_analysis/dataloader.py`

### Latent models

- [Probabilistic CCA](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M2_G02/Code/src/pcca.py): `M2_G02/Code/src/pcca.py`
- [M4 PCCA](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M4_G02/Code/src/pcca.py): `M4_G02/Code/src/pcca.py`
- [CCA methods](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/01_methods/cca/cca.m): `01_methods/cca/cca.m`
- [Sparse CCA](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/01_methods/group_scca/sparse_cca.m): `01_methods/group_scca/sparse_cca.m`
- [Graph CCA](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/01_methods/gn_scca/gn_scca.m): `01_methods/gn_scca/gn_scca.m`
- [Deflation methods](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/01_methods/deflation/projection_deflation.m): `01_methods/deflation/projection_deflation.m`

### Survival evaluation

- [Cox survival](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M2_G02/Code/src/survival.py): `M2_G02/Code/src/survival.py`
- [M4 survival](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M4_G02/Code/src/survival.py): `M4_G02/Code/src/survival.py`
- [Reference Cox runs](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/03_brca/A_survival_prediction/run_coxph_final.py): `03_brca/A_survival_prediction/run_coxph_final.py`
- [Result utilities](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/03_brca/B_analyse_results/utils.py): `03_brca/B_analyse_results/utils.py`

### Experiments and analysis

- [M2 experiments](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M2_G02/Code/src/run_experiments.py): `M2_G02/Code/src/run_experiments.py`
- [Latent dimension sweep](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M2_G02/Code/src/sweep_latent_dim.py): `M2_G02/Code/src/sweep_latent_dim.py`
- [Paper baseline](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M2_G02/Code/src/paper_baseline.py): `M2_G02/Code/src/paper_baseline.py`
- [M3 robustness](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M3_G02/Code/src/run_robustness.py): `M3_G02/Code/src/run_robustness.py`
- [M4 experiments](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M4_G02/Code/src/run_experiments.py): `M4_G02/Code/src/run_experiments.py`
- [M4 robustness](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M4_G02/Code/src/run_robustness.py): `M4_G02/Code/src/run_robustness.py`
- [Posterior quality](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/M4_G02/Code/src/probability_quality.py): `M4_G02/Code/src/probability_quality.py`
- [Basic simulations](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/02_simulations/01_K-basic/step1_generate_data_simple.m): `02_simulations/01_K-basic/step1_generate_data_simple.m`
- [Sparse simulations](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/02_simulations/02_K-sparse/step1_generate_data_sparse.m): `02_simulations/02_K-sparse/step1_generate_data_sparse.m`
- [Graph simulations](https://github.com/shifaa174/cse-516--pgm_healthcare_brca/blob/main/02_simulations/03_K-graph/step1_generate_data_graph.m): `02_simulations/03_K-graph/step1_generate_data_graph.m`

### Other components

- **Researcher**

## Connections

- Researcher → M2 experiments: runs (evidence: `M2_G02/Code/src/run_experiments.py`)
- M2 experiments → Fold loading: loads folds (evidence: `M2_G02/Code/src/run_experiments.py`)
- M2 experiments → Probabilistic CCA: fits model (evidence: `M2_G02/Code/src/run_experiments.py`)
- M2 experiments → Cox survival: scores risk (evidence: `M2_G02/Code/src/run_experiments.py`)
- Latent dimension sweep → Fold loading: loads folds (evidence: `M2_G02/Code/src/sweep_latent_dim.py`)
- Latent dimension sweep → Probabilistic CCA: fits candidates (evidence: `M2_G02/Code/src/sweep_latent_dim.py`)
- Latent dimension sweep → Cox survival: scores candidates (evidence: `M2_G02/Code/src/sweep_latent_dim.py`)
- Paper baseline → Cox survival: uses survival (evidence: `M2_G02/Code/src/paper_baseline.py`)
- M3 robustness → Fold loading: loads folds (evidence: `M3_G02/Code/src/run_robustness.py`)
- M3 robustness → Probabilistic CCA: fits model (evidence: `M3_G02/Code/src/run_robustness.py`)
- M3 robustness → Cox survival: scores risk (evidence: `M3_G02/Code/src/run_robustness.py`)
- M4 experiments → M4 fold loading: loads folds (evidence: `M4_G02/Code/src/run_experiments.py`)
- M4 experiments → M4 PCCA: fits model (evidence: `M4_G02/Code/src/run_experiments.py`)
- M4 experiments → M4 survival: scores risk (evidence: `M4_G02/Code/src/run_experiments.py`)
- M4 robustness → M4 fold loading: loads folds (evidence: `M4_G02/Code/src/run_robustness.py`)
- M4 robustness → M4 PCCA: fits model (evidence: `M4_G02/Code/src/run_robustness.py`)
- M4 robustness → M4 survival: scores risk (evidence: `M4_G02/Code/src/run_robustness.py`)
- Reference Cox runs → Prediction data: loads dataset (evidence: `03_brca/A_survival_prediction/run_coxph_final.py`)
- Reference Cox runs → CCA methods: uses CCA baseline
- Researcher → CCA methods: uses reference
- Researcher → Sparse CCA: uses reference
- Researcher → Graph CCA: uses reference
- Researcher → Basic simulations: runs simulations
- Researcher → Sparse simulations: runs simulations
- Researcher → Graph simulations: runs simulations
