# nafeytauheed-cyber/losslearning architecture

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

- Interactive diagram: https://gitdiagram.com/nafeytauheed-cyber/losslearning
- Repository: https://github.com/nafeytauheed-cyber/losslearning

## Overview

LossLearning is an experimental PyTorch classification framework for learning with noisy labels. The user-facing path is to fit the estimator on labeled data, which builds an encoder/head model and trains it with an indexed trainer; adaptive runs use teacher/reference-bank evidence to adjust generalized cross-entropy, then expose predictions and scores. A separate experiment runner evaluates synthetic, image, and CIFAR-10N settings and produces analysis artifacts. The graph reflects the excerpts and README; some internal calls in unsampled code are not asserted.

Main entry points: [`src/losslearning/training.py`](https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/training.py) (Indexed trainer), [`src/losslearning/estimator.py`](https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/estimator.py) (Estimator API), [`src/losslearning/experiments.py`](https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/experiments.py) (Benchmark runner), [`src/losslearning/validation.py`](https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/validation.py) (Influence validation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Classifier API"]
  node_estimator["Estimator API<br/>[estimator.py]"]
end

subgraph group_learning["Training and adaptation"]
  node_network["Encoder and heads<br/>[models.py]"]
  node_trainer["Indexed trainer<br/>[training.py]"]
  node_adapt["Teacher and bank<br/>[adaptation.py]"]
  node_influence["Influence evidence<br/>[adaptation.py]"]
  node_controller["Adaptive controller<br/>[adaptation.py]"]
  node_loss["Robust losses<br/>[losses.py]"]
end

subgraph group_experiments["Experiment workflows"]
  node_synthetic["Synthetic data<br/>[data.py]"]
  node_runner["Benchmark runner<br/>[experiments.py]"]
  node_image["Image pilots<br/>[images.py]"]
  node_cifar["CIFAR-10N pilot<br/>[cifar10n.py]"]
end

subgraph group_analysis["Validation and reporting"]
  node_validation["Influence validation<br/>[validation.py]"]
  node_viz["Diagnostic figures<br/>[visualization.py]"]
  node_release["Release reports<br/>[release_report.py]"]
  node_outputs["Run artifacts"]
end

node_user(("Model user"))

node_user -->|"fits and predicts"| node_estimator
node_estimator -->|"constructs"| node_network
node_estimator -->|"trains through"| node_trainer
node_trainer -->|"updates teacher and bank"| node_adapt
node_trainer -->|"estimates evidence"| node_influence
node_trainer -->|"sets adaptive q"| node_controller
node_trainer -->|"computes loss"| node_loss
node_runner -->|"creates splits"| node_synthetic
node_runner -->|"runs methods"| node_estimator
node_runner -->|"dispatches image pilots"| node_image
node_runner -->|"dispatches CIFAR-10N"| node_cifar
node_image -->|"constructs"| node_network
node_image -->|"trains through"| node_trainer
node_cifar -->|"trains through"| node_trainer
node_validation -->|"checks estimator"| node_influence
node_validation -->|"uses geometry data"| node_synthetic
node_validation -->|"runs stale diagnostic"| node_estimator
node_runner -->|"generates figures"| node_viz
node_viz -->|"queries predictions"| node_estimator
node_release -->|"imports plotting"| node_viz
node_release -->|"packages results"| node_outputs

click node_estimator "https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/estimator.py"
click node_network "https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/models.py"
click node_trainer "https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/training.py"
click node_adapt "https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/adaptation.py"
click node_influence "https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/adaptation.py"
click node_controller "https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/adaptation.py"
click node_loss "https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/losses.py"
click node_synthetic "https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/data.py"
click node_runner "https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/experiments.py"
click node_image "https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/images.py"
click node_cifar "https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/cifar10n.py"
click node_validation "https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/validation.py"
click node_viz "https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/visualization.py"
click node_release "https://github.com/nafeytauheed-cyber/losslearning/blob/main/experiments/release_report.py"
click node_outputs "https://github.com/nafeytauheed-cyber/losslearning/tree/main/results/release"

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_estimator,node_user toneBlue
class node_network,node_trainer,node_adapt,node_influence,node_controller,node_loss toneAmber
class node_synthetic,node_runner,node_image,node_cifar toneMint
class node_validation,node_viz,node_release,node_outputs toneRose
```

## Components

### Classifier API

- [Estimator API](https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/estimator.py): `src/losslearning/estimator.py`

### Training and adaptation

- [Encoder and heads](https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/models.py): `src/losslearning/models.py`
- [Indexed trainer](https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/training.py): `src/losslearning/training.py`
- [Teacher and bank](https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/adaptation.py): `src/losslearning/adaptation.py`
- [Influence evidence](https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/adaptation.py): `src/losslearning/adaptation.py`
- [Adaptive controller](https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/adaptation.py): `src/losslearning/adaptation.py`
- [Robust losses](https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/losses.py): `src/losslearning/losses.py`

### Experiment workflows

- [Synthetic data](https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/data.py): `src/losslearning/data.py`
- [Benchmark runner](https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/experiments.py): `src/losslearning/experiments.py`
- [Image pilots](https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/images.py): `src/losslearning/images.py`
- [CIFAR-10N pilot](https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/cifar10n.py): `src/losslearning/cifar10n.py`

### Validation and reporting

- [Influence validation](https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/validation.py): `src/losslearning/validation.py`
- [Diagnostic figures](https://github.com/nafeytauheed-cyber/losslearning/blob/main/src/losslearning/visualization.py): `src/losslearning/visualization.py`
- [Release reports](https://github.com/nafeytauheed-cyber/losslearning/blob/main/experiments/release_report.py): `experiments/release_report.py`
- [Run artifacts](https://github.com/nafeytauheed-cyber/losslearning/tree/main/results/release): `results/release`

### Other components

- **Model user**

## Connections

- Model user → Estimator API: fits and predicts (evidence: `README.md`)
- Estimator API → Encoder and heads: constructs (evidence: `src/losslearning/estimator.py`)
- Estimator API → Indexed trainer: trains through (evidence: `src/losslearning/estimator.py`)
- Indexed trainer → Teacher and bank: updates teacher and bank (evidence: `src/losslearning/training.py`)
- Indexed trainer → Influence evidence: estimates evidence (evidence: `src/losslearning/training.py`)
- Indexed trainer → Adaptive controller: sets adaptive q (evidence: `src/losslearning/training.py`)
- Indexed trainer → Robust losses: computes loss (evidence: `src/losslearning/training.py`)
- Benchmark runner → Synthetic data: creates splits (evidence: `src/losslearning/experiments.py`)
- Benchmark runner → Estimator API: runs methods (evidence: `src/losslearning/experiments.py`)
- Benchmark runner → Image pilots: dispatches image pilots (evidence: `src/losslearning/experiments.py`)
- Benchmark runner → CIFAR-10N pilot: dispatches CIFAR-10N (evidence: `src/losslearning/experiments.py`)
- Image pilots → Encoder and heads: constructs (evidence: `src/losslearning/images.py`)
- Image pilots → Indexed trainer: trains through (evidence: `src/losslearning/images.py`)
- CIFAR-10N pilot → Indexed trainer: trains through (evidence: `src/losslearning/cifar10n.py`)
- Influence validation → Influence evidence: checks estimator (evidence: `src/losslearning/validation.py`)
- Influence validation → Synthetic data: uses geometry data (evidence: `src/losslearning/validation.py`)
- Influence validation → Estimator API: runs stale diagnostic (evidence: `src/losslearning/validation.py`)
- Benchmark runner → Diagnostic figures: generates figures (evidence: `src/losslearning/experiments.py`)
- Diagnostic figures → Estimator API: queries predictions (evidence: `src/losslearning/visualization.py`)
- Release reports → Diagnostic figures: imports plotting (evidence: `experiments/release_report.py`)
- Release reports → Run artifacts: packages results (evidence: `experiments/release_report.py`)
