# obananas/gmae architecture

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

- Interactive diagram: https://gitdiagram.com/obananas/gmae
- Repository: https://github.com/obananas/gmae

## Overview

GMAE is a research codebase for generalized multi-view representation learning, with separate classification and clustering entry points. Both load MAT-format views, train a shared/view-specific autoencoder, and evaluate learned representations; classification also uses a prediction head, while clustering applies K-means. The graph preserves the documented reconstruction, alignment, adversarial, and contrastive objectives, plus preprocessing and reporting. Connections are limited to calls shown in excerpts or relationships explicitly documented in the README; unsampled implementation details are not inferred.

Main entry points: [`classification.py`](https://github.com/obananas/gmae/blob/main/classification.py) (Classification task), [`clustering.py`](https://github.com/obananas/gmae/blob/main/clustering.py) (Clustering task), [`models.py`](https://github.com/obananas/gmae/blob/main/models.py) (GMAE representations), [`utils/dataloader.py`](https://github.com/obananas/gmae/blob/main/utils/dataloader.py) (MAT data loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Task workflows"]
  node_classification["Classification task<br/>[classification.py]"]
  node_clustering["Clustering task<br/>[clustering.py]"]
end

subgraph group_data["Data and sampling"]
  node_loader["MAT data loader<br/>[dataloader.py]"]
  node_dataset["Multi-view dataset<br/>[dataloader.py]"]
  node_matfile["Digits-2V data<br/>[Digits-2V.mat]"]
  node_neighbors["Neighbor sampling<br/>[clustering.py]"]
end

subgraph group_model["Representation learning"]
  node_encoder["View encoders<br/>[models.py]"]
  node_decoder["View decoders<br/>[models.py]"]
  node_discriminator["View discriminators<br/>[models.py]"]
  node_gmae["GMAE representations<br/>[models.py]"]
  node_classifier["Classification head<br/>[models.py]"]
  node_objectives["Training objectives<br/>[loss.py]"]
end

subgraph group_evaluation["Evaluation and reporting"]
  node_metrics["Clustering metrics<br/>[metric.py]"]
  node_logger["Run logger<br/>[Logger.py]"]
  node_plotter["Metric plots<br/>[plot.py]"]
end

node_user(("Research user"))

node_user -->|"runs task"| node_classification
node_user -->|"runs task"| node_clustering
node_classification -->|"loads dataset"| node_loader
node_clustering -->|"loads dataset"| node_loader
node_loader -->|"reads MAT data"| node_matfile
node_loader -->|"builds dataset"| node_dataset
node_classification -->|"perturbs views"| node_dataset
node_classification -->|"samples neighbors"| node_neighbors
node_clustering -->|"prepares neighbors"| node_neighbors
node_classification -->|"invokes model"| node_gmae
node_clustering -->|"invokes model"| node_gmae
node_gmae -->|"encodes views"| node_encoder
node_gmae -->|"reconstructs views"| node_decoder
node_gmae -->|"evaluates latents"| node_discriminator
node_gmae -->|"classifies representation"| node_classifier
node_classification -->|"computes losses"| node_objectives
node_clustering -->|"computes losses"| node_objectives
node_classification -->|"evaluates predictions"| node_metrics
node_clustering -->|"evaluates clusters"| node_metrics
node_classification -->|"records results"| node_logger
node_clustering -->|"records results"| node_logger
node_classification -->|"plots metrics"| node_plotter
node_clustering -->|"plots metrics"| node_plotter

click node_classification "https://github.com/obananas/gmae/blob/main/classification.py"
click node_clustering "https://github.com/obananas/gmae/blob/main/clustering.py"
click node_loader "https://github.com/obananas/gmae/blob/main/utils/dataloader.py"
click node_dataset "https://github.com/obananas/gmae/blob/main/utils/dataloader.py"
click node_matfile "https://github.com/obananas/gmae/blob/main/dataset/Digits-2V.mat"
click node_neighbors "https://github.com/obananas/gmae/blob/main/clustering.py"
click node_encoder "https://github.com/obananas/gmae/blob/main/models.py"
click node_decoder "https://github.com/obananas/gmae/blob/main/models.py"
click node_discriminator "https://github.com/obananas/gmae/blob/main/models.py"
click node_gmae "https://github.com/obananas/gmae/blob/main/models.py"
click node_classifier "https://github.com/obananas/gmae/blob/main/models.py"
click node_objectives "https://github.com/obananas/gmae/blob/main/loss.py"
click node_metrics "https://github.com/obananas/gmae/blob/main/utils/metric.py"
click node_logger "https://github.com/obananas/gmae/blob/main/utils/Logger.py"
click node_plotter "https://github.com/obananas/gmae/blob/main/utils/plot.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_classification,node_clustering,node_user toneBlue
class node_loader,node_dataset,node_matfile,node_neighbors toneAmber
class node_encoder,node_decoder,node_discriminator,node_gmae,node_classifier,node_objectives toneMint
class node_metrics,node_logger,node_plotter toneRose
```

## Components

### Task workflows

- [Classification task](https://github.com/obananas/gmae/blob/main/classification.py): `classification.py`
- [Clustering task](https://github.com/obananas/gmae/blob/main/clustering.py): `clustering.py`

### Data and sampling

- [MAT data loader](https://github.com/obananas/gmae/blob/main/utils/dataloader.py): `utils/dataloader.py`
- [Multi-view dataset](https://github.com/obananas/gmae/blob/main/utils/dataloader.py): `utils/dataloader.py`
- [Digits-2V data](https://github.com/obananas/gmae/blob/main/dataset/Digits-2V.mat): `dataset/Digits-2V.mat`
- [Neighbor sampling](https://github.com/obananas/gmae/blob/main/clustering.py): `clustering.py`

### Representation learning

- [View encoders](https://github.com/obananas/gmae/blob/main/models.py): `models.py`
- [View decoders](https://github.com/obananas/gmae/blob/main/models.py): `models.py`
- [View discriminators](https://github.com/obananas/gmae/blob/main/models.py): `models.py`
- [GMAE representations](https://github.com/obananas/gmae/blob/main/models.py): `models.py`
- [Classification head](https://github.com/obananas/gmae/blob/main/models.py): `models.py`
- [Training objectives](https://github.com/obananas/gmae/blob/main/loss.py): `loss.py`

### Evaluation and reporting

- [Clustering metrics](https://github.com/obananas/gmae/blob/main/utils/metric.py): `utils/metric.py`
- [Run logger](https://github.com/obananas/gmae/blob/main/utils/Logger.py): `utils/Logger.py`
- [Metric plots](https://github.com/obananas/gmae/blob/main/utils/plot.py): `utils/plot.py`

### Other components

- **Research user**

## Connections

- Research user → Classification task: runs task (evidence: `README.md`)
- Research user → Clustering task: runs task (evidence: `README.md`)
- Classification task → MAT data loader: loads dataset (evidence: `classification.py`)
- Clustering task → MAT data loader: loads dataset (evidence: `clustering.py`)
- MAT data loader → Digits-2V data: reads MAT data (evidence: `utils/dataloader.py`)
- MAT data loader → Multi-view dataset: builds dataset (evidence: `utils/dataloader.py`)
- Classification task → Multi-view dataset: perturbs views (evidence: `classification.py`)
- Classification task → Neighbor sampling: samples neighbors (evidence: `classification.py`)
- Clustering task → Neighbor sampling: prepares neighbors (evidence: `clustering.py`)
- Classification task → GMAE representations: invokes model (evidence: `classification.py`)
- Clustering task → GMAE representations: invokes model (evidence: `clustering.py`)
- GMAE representations → View encoders: encodes views (evidence: `models.py`)
- GMAE representations → View decoders: reconstructs views (evidence: `models.py`)
- GMAE representations → View discriminators: evaluates latents (evidence: `models.py`)
- GMAE representations → Classification head: classifies representation (evidence: `models.py`)
- Classification task → Training objectives: computes losses (evidence: `classification.py`)
- Clustering task → Training objectives: computes losses (evidence: `clustering.py`)
- Classification task → Clustering metrics: evaluates predictions (evidence: `classification.py`)
- Clustering task → Clustering metrics: evaluates clusters (evidence: `clustering.py`)
- Classification task → Run logger: records results (evidence: `classification.py`)
- Clustering task → Run logger: records results (evidence: `clustering.py`)
- Classification task → Metric plots: plots metrics (evidence: `classification.py`)
- Clustering task → Metric plots: plots metrics (evidence: `clustering.py`)
