# taathvika-m/mutual_modality_selection architecture

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

- Interactive diagram: https://gitdiagram.com/taathvika-m/mutual_modality_selection
- Repository: https://github.com/taathvika-m/mutual_modality_selection

## Overview

This is a small Python library for estimating mutual information with the KSG k-nearest-neighbor method. Its principal workflow takes paired samples, prepares and standardizes them, counts neighbors in joint and marginal spaces, and returns an MI estimate. The repository also includes synthetic and MIMIC-IV demo workflows for modality-value and redundancy analysis. The real-data demo implements its own estimator rather than calling the library. Evidence is limited to the supplied excerpts; the README is empty.

Main entry points: [`code/mi_estimator/ksg.py`](https://github.com/taathvika-m/mutual_modality_selection/blob/main/code/mi_estimator/ksg.py) (KSG estimator), [`code/experiments/simulation.py`](https://github.com/taathvika-m/mutual_modality_selection/blob/main/code/experiments/simulation.py) (Synthetic analysis), [`code/experiments/week_real_data_demo.py`](https://github.com/taathvika-m/mutual_modality_selection/blob/main/code/experiments/week_real_data_demo.py) (MIMIC analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_library["MI library"]
  node_ksg["KSG estimator<br/>[ksg.py]"]
end

subgraph group_demos["Analysis demos"]
  node_simulation["Synthetic analysis<br/>[simulation.py]"]
  node_mimic["MIMIC analysis"]
end

node_user(("Caller"))
node_mimicdata[("MIMIC-IV demo data")]

node_user -->|"calls"| node_ksg
node_simulation -->|"calls"| node_ksg
node_mimicdata -->|"reads"| node_mimic

click node_ksg "https://github.com/taathvika-m/mutual_modality_selection/blob/main/code/mi_estimator/ksg.py"
click node_simulation "https://github.com/taathvika-m/mutual_modality_selection/blob/main/code/experiments/simulation.py"
click node_mimic "https://github.com/taathvika-m/mutual_modality_selection/blob/main/code/experiments/week_real_data_demo.py"

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_ksg toneBlue
class node_simulation,node_mimic,node_mimicdata toneAmber
class node_user toneIndigo
```

## Components

### MI library

- [KSG estimator](https://github.com/taathvika-m/mutual_modality_selection/blob/main/code/mi_estimator/ksg.py): `code/mi_estimator/ksg.py`

### Analysis demos

- [Synthetic analysis](https://github.com/taathvika-m/mutual_modality_selection/blob/main/code/experiments/simulation.py): `code/experiments/simulation.py`
- [MIMIC analysis](https://github.com/taathvika-m/mutual_modality_selection/blob/main/code/experiments/week_real_data_demo.py): `code/experiments/week_real_data_demo.py`

### Other components

- **Caller**
- **MIMIC-IV demo data**

## Connections

- Caller → KSG estimator: calls
- Synthetic analysis → KSG estimator: calls (evidence: `code/experiments/simulation.py`)
- MIMIC-IV demo data → MIMIC analysis: reads (evidence: `code/experiments/week_real_data_demo.py`)
