# dys2108/sbl architecture

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

- Interactive diagram: https://gitdiagram.com/dys2108/sbl
- Repository: https://github.com/dys2108/sbl

## Overview

This repository implements unsupervised spectral-basis learning for graph matrices: a user supplies dataset and result paths, `src/main.py` loads mesh features and graph/Laplacian matrices, invokes the TensorFlow basis model, and either trains it or produces test embeddings. Training losses and checkpointing are handled in the entry point; testing writes basis outputs. The `matlab/` numerical-analysis files are included as a separate capability, but the excerpts do not establish their call relationships. The imported `utils` module is absent from the tree, so its behavior is omitted.

Main entry points: [`src/main.py`](https://github.com/dys2108/sbl/blob/main/src/main.py) (Training and testing), [`src/model.py`](https://github.com/dys2108/sbl/blob/main/src/model.py) (Basis model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Data workflow"]
  node_main["Training and testing<br/>[main.py]"]
  node_checkpoint["Model checkpoints"]
  node_embeddings["Embedding results"]
end

subgraph group_learning["Spectral learning"]
  node_model["Basis model<br/>[model.py]"]
  node_loss["Spectral objectives<br/>[main.py]"]
end

subgraph group_matlab["MATLAB analysis"]
  node_base_analysis["Base analysis<br/>[base_analysis.m]"]
  node_cal_acd["ACD16 calculation<br/>[cal_ACD16.m]"]
  node_cal_cos["Cosine calculation<br/>[cal_cos.m]"]
  node_cal_diag["Diagonal calculation<br/>[cal_diag.m]"]
  node_cal_orth["Orthogonality calculation<br/>[cal_orth.m]"]
end

node_user(("Research user"))
node_dataset["Mesh datasets"]

node_user -->|"configures paths"| node_main
node_dataset -->|"provides inputs"| node_main
node_main -->|"builds and runs"| node_model
node_model -->|"returns bases"| node_main
node_main -->|"computes objectives"| node_loss
node_main -->|"saves checkpoints"| node_checkpoint
node_main -->|"writes embeddings"| node_embeddings

click node_main "https://github.com/dys2108/sbl/blob/main/src/main.py"
click node_model "https://github.com/dys2108/sbl/blob/main/src/model.py"
click node_loss "https://github.com/dys2108/sbl/blob/main/src/main.py"
click node_base_analysis "https://github.com/dys2108/sbl/blob/main/matlab/base_analysis.m"
click node_cal_acd "https://github.com/dys2108/sbl/blob/main/matlab/cal_ACD16.m"
click node_cal_cos "https://github.com/dys2108/sbl/blob/main/matlab/cal_cos.m"
click node_cal_diag "https://github.com/dys2108/sbl/blob/main/matlab/cal_diag.m"
click node_cal_orth "https://github.com/dys2108/sbl/blob/main/matlab/cal_orth.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_main,node_checkpoint,node_embeddings,node_user toneBlue
class node_model,node_loss toneAmber
class node_base_analysis,node_cal_acd,node_cal_cos,node_cal_diag,node_cal_orth toneMint
class node_dataset toneIndigo
```

## Components

### Data workflow

- [Training and testing](https://github.com/dys2108/sbl/blob/main/src/main.py): `src/main.py`
- **Model checkpoints**
- **Embedding results**

### Spectral learning

- [Basis model](https://github.com/dys2108/sbl/blob/main/src/model.py): `src/model.py`
- [Spectral objectives](https://github.com/dys2108/sbl/blob/main/src/main.py): `src/main.py`

### MATLAB analysis

- [Base analysis](https://github.com/dys2108/sbl/blob/main/matlab/base_analysis.m): `matlab/base_analysis.m`
- [ACD16 calculation](https://github.com/dys2108/sbl/blob/main/matlab/cal_ACD16.m): `matlab/cal_ACD16.m`
- [Cosine calculation](https://github.com/dys2108/sbl/blob/main/matlab/cal_cos.m): `matlab/cal_cos.m`
- [Diagonal calculation](https://github.com/dys2108/sbl/blob/main/matlab/cal_diag.m): `matlab/cal_diag.m`
- [Orthogonality calculation](https://github.com/dys2108/sbl/blob/main/matlab/cal_orth.m): `matlab/cal_orth.m`

### Other components

- **Research user**
- **Mesh datasets**

## Connections

- Research user → Training and testing: configures paths
- Mesh datasets → Training and testing: provides inputs
- Training and testing → Basis model: builds and runs
- Basis model → Training and testing: returns bases
- Training and testing → Spectral objectives: computes objectives
- Training and testing → Model checkpoints: saves checkpoints
- Training and testing → Embedding results: writes embeddings
