# dbis-uibk/srgnn-emo architecture

> Architecture diagram of the GitHub repository dbis-uibk/srgnn-emo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dbis-uibk/srgnn-emo
- Repository: https://github.com/dbis-uibk/srgnn-emo

## Overview

SRGNN-EMO predicts nine music-emotion targets from track features and a multi-relational track graph. The workflow prepares session-, tag-, and genre-based graph relations, loads graph/features/labels, then trains and cross-validates a semi-supervised graph model and reports metrics. The implementation separates graph construction, orchestration, and model layers. Some trainer and graph-builder excerpts are partial; edges are limited to shown calls or README statements, so unsampled internals are not inferred.

Main entry points: [`main.py`](https://github.com/dbis-uibk/srgnn-emo/blob/main/main.py) (Experiment entrypoint), [`model/trainer.py`](https://github.com/dbis-uibk/srgnn-emo/blob/main/model/trainer.py) (Fold trainer), [`model/shgr.py`](https://github.com/dbis-uibk/srgnn-emo/blob/main/model/shgr.py) (Semi-supervised SHGR), [`model/encoder.py`](https://github.com/dbis-uibk/srgnn-emo/blob/main/model/encoder.py) (Weighted graph encoder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_prep["Graph preparation"]
  node_graph_builder["Relation graph builder<br/>[build_graphs.py]"]
  node_graph_artifact["Multi-relation graph"]
end

subgraph group_runtime["Experiment runtime"]
  node_entrypoint["Experiment entrypoint<br/>[main.py]"]
  node_hyperparams["Representation settings<br/>[params.py]"]
  node_data_loader["Feature and label loader<br/>[utils.py]"]
  node_runtime_utils["Seed and device utilities<br/>[utils.py]"]
end

subgraph group_learning["Model and learning"]
  node_shgr["Semi-supervised SHGR<br/>[shgr.py]"]
  node_encoder["Weighted graph encoder<br/>[encoder.py]"]
  node_conv_layer["Relational convolution<br/>[layer.py]"]
  node_regressor["Emotion regressor<br/>[regressor.py]"]
end

subgraph group_evaluation["Training and evaluation"]
  node_trainer["Fold trainer<br/>[trainer.py]"]
  node_augmentations["Graph augmentations<br/>[transforms.py]"]
end

node_researcher(("Researcher"))
node_source_data["Music metadata"]
node_prepared_data["Prepared features and labels"]

node_researcher -->|"runs experiment"| node_entrypoint
node_source_data -->|"builds relations"| node_graph_builder
node_graph_builder -->|"writes graph"| node_graph_artifact
node_prepared_data -->|"provides inputs"| node_data_loader
node_entrypoint -->|"gets settings"| node_hyperparams
node_entrypoint -->|"seeds runtime"| node_runtime_utils
node_entrypoint -->|"loads features"| node_data_loader
node_entrypoint -->|"loads graph"| node_graph_artifact
node_entrypoint -->|"constructs encoder"| node_encoder
node_entrypoint -->|"constructs regressor"| node_regressor
node_entrypoint -->|"assembles model"| node_shgr
node_entrypoint -->|"starts folds"| node_trainer
node_encoder -->|"uses convolution"| node_conv_layer
node_trainer -->|"trains and evaluates"| node_shgr
node_trainer -->|"computes representations"| node_encoder
node_trainer -->|"predicts targets"| node_regressor
node_trainer -->|"configures graph drops"| node_augmentations
node_shgr -->|"owns encoder"| node_encoder
node_shgr -->|"owns regressor"| node_regressor

click node_graph_builder "https://github.com/dbis-uibk/srgnn-emo/blob/main/preprocessing/build_graphs.py"
click node_entrypoint "https://github.com/dbis-uibk/srgnn-emo/blob/main/main.py"
click node_hyperparams "https://github.com/dbis-uibk/srgnn-emo/blob/main/params.py"
click node_data_loader "https://github.com/dbis-uibk/srgnn-emo/blob/main/preprocessing/utils.py"
click node_runtime_utils "https://github.com/dbis-uibk/srgnn-emo/blob/main/model/utils.py"
click node_trainer "https://github.com/dbis-uibk/srgnn-emo/blob/main/model/trainer.py"
click node_augmentations "https://github.com/dbis-uibk/srgnn-emo/blob/main/model/transforms.py"
click node_shgr "https://github.com/dbis-uibk/srgnn-emo/blob/main/model/shgr.py"
click node_encoder "https://github.com/dbis-uibk/srgnn-emo/blob/main/model/encoder.py"
click node_conv_layer "https://github.com/dbis-uibk/srgnn-emo/blob/main/model/layer.py"
click node_regressor "https://github.com/dbis-uibk/srgnn-emo/blob/main/model/regressor.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_graph_builder,node_graph_artifact toneBlue
class node_entrypoint,node_hyperparams,node_data_loader,node_runtime_utils toneAmber
class node_shgr,node_encoder,node_conv_layer,node_regressor toneMint
class node_trainer,node_augmentations toneRose
class node_researcher,node_source_data,node_prepared_data toneIndigo
```

## Components

### Graph preparation

- [Relation graph builder](https://github.com/dbis-uibk/srgnn-emo/blob/main/preprocessing/build_graphs.py): `preprocessing/build_graphs.py`
- **Multi-relation graph**

### Experiment runtime

- [Experiment entrypoint](https://github.com/dbis-uibk/srgnn-emo/blob/main/main.py): `main.py`
- [Representation settings](https://github.com/dbis-uibk/srgnn-emo/blob/main/params.py): `params.py`
- [Feature and label loader](https://github.com/dbis-uibk/srgnn-emo/blob/main/preprocessing/utils.py): `preprocessing/utils.py`
- [Seed and device utilities](https://github.com/dbis-uibk/srgnn-emo/blob/main/model/utils.py): `model/utils.py`

### Model and learning

- [Semi-supervised SHGR](https://github.com/dbis-uibk/srgnn-emo/blob/main/model/shgr.py): `model/shgr.py`
- [Weighted graph encoder](https://github.com/dbis-uibk/srgnn-emo/blob/main/model/encoder.py): `model/encoder.py`
- [Relational convolution](https://github.com/dbis-uibk/srgnn-emo/blob/main/model/layer.py): `model/layer.py`
- [Emotion regressor](https://github.com/dbis-uibk/srgnn-emo/blob/main/model/regressor.py): `model/regressor.py`

### Training and evaluation

- [Fold trainer](https://github.com/dbis-uibk/srgnn-emo/blob/main/model/trainer.py): `model/trainer.py`
- [Graph augmentations](https://github.com/dbis-uibk/srgnn-emo/blob/main/model/transforms.py): `model/transforms.py`

### Other components

- **Researcher**
- **Music metadata**
- **Prepared features and labels**

## Connections

- Researcher → Experiment entrypoint: runs experiment (evidence: `README.md`)
- Music metadata → Relation graph builder: builds relations (evidence: `README.md`)
- Relation graph builder → Multi-relation graph: writes graph (evidence: `README.md`)
- Prepared features and labels → Feature and label loader: provides inputs (evidence: `README.md`)
- Experiment entrypoint → Representation settings: gets settings (evidence: `main.py`)
- Experiment entrypoint → Seed and device utilities: seeds runtime (evidence: `main.py`)
- Experiment entrypoint → Feature and label loader: loads features (evidence: `main.py`)
- Experiment entrypoint → Multi-relation graph: loads graph (evidence: `main.py`)
- Experiment entrypoint → Weighted graph encoder: constructs encoder (evidence: `main.py`)
- Experiment entrypoint → Emotion regressor: constructs regressor (evidence: `main.py`)
- Experiment entrypoint → Semi-supervised SHGR: assembles model (evidence: `main.py`)
- Experiment entrypoint → Fold trainer: starts folds (evidence: `main.py`)
- Weighted graph encoder → Relational convolution: uses convolution (evidence: `model/encoder.py`)
- Fold trainer → Semi-supervised SHGR: trains and evaluates (evidence: `model/trainer.py`)
- Fold trainer → Weighted graph encoder: computes representations (evidence: `model/trainer.py`)
- Fold trainer → Emotion regressor: predicts targets (evidence: `model/trainer.py`)
- Fold trainer → Graph augmentations: configures graph drops (evidence: `model/trainer.py`)
- Semi-supervised SHGR → Weighted graph encoder: owns encoder (evidence: `model/shgr.py`)
- Semi-supervised SHGR → Emotion regressor: owns regressor (evidence: `model/shgr.py`)
