Skip to content

feat: add CCC, Huber, and CLIP losses with per-pathway validation met…#10

Merged
BenjaminIsaac0111 merged 1 commit into
mainfrom
feat/loss-functions-improvement
Jun 9, 2026
Merged

feat: add CCC, Huber, and CLIP losses with per-pathway validation met…#10
BenjaminIsaac0111 merged 1 commit into
mainfrom
feat/loss-functions-improvement

Conversation

@BenjaminIsaac0111

Copy link
Copy Markdown
Owner

1. Core Loss Function Upgrades

  • New Loss Criteria (losses.py):
    • CCCLoss: Added Concordance Correlation Coefficient loss to reward both correct pattern correlation and proper scaling.
    • CompositeLoss: Updated to allow configurable combinations of MSE/Huber and PCC/CCC..
  • Unit Tests (test_losses.py): Added comprehensive testing for all the new loss criteria under masked and unmasked scenarios.

2. Validation & Metrics Enhancements

  • Validation Engine (engine.py):
    • Overhauled validation to compute, log, and return both PCC and CCC metrics.
    • Added per-pathway tracking to output a breakdown of the top-3 best and worst pathways by CCC performance.
    • Added tracking for prediction variance (to detect representation collapse) and comparison against baseline MAEs.
  • Trainer Integration (trainer.py): Integrated the updated metrics logging with the main training loop.

3. Exploratory SVG (Spatially Variable Genes) Analysis

  • SVG Script (analyze_svg.py): Added a script to identify, map, and analyse spatially variable genes in the tissue samples.
  • SVG Documentation (SVG_HEST_EXPLORATORY_ANALYSIS.md): Documented the SVG pipeline findings and methodology.

4. Recipes & Data Pipelines

5. CLI Arguments, Presets, and Checkpoints

  • Configurability (arguments.py & builder.py):
    • Added CLI parameters to switch between mse / huber and pcc / ccc, and set CLIP weights/temperatures.
    • Presets in run_preset.py and trainer entry points in train.py were updated to handle these configuration pipelines.
  • Checkpoint Serialisation (checkpoint.py): Updated serializers to correctly save and reload states, including new training args.

6. Visualization & UI

  • Plots and Dash Callback Updates (visualisation.py & callbacks.py): Aligned visualisations and dashboard logic with the new model outputs.

…rics and SVG analysis

- Implement CCCLoss, MaskedHuberLoss, and CLIPAlignmentLoss in training losses.
- Update CompositeLoss to support configurable combinations of MSE/Huber, PCC/CCC, and optional CLIP regularisation for future work.
- Enhance validation engine to compute, track, and log both PCC and CCC metrics, including slide-level and per-pathway breakdowns.
- Add exploratory SVG (Spatially Variable Genes) analysis script and documentation.
- Update argument parsing, presets, pathways computation, checkpointing, and visualization.
- Implement comprehensive unit tests for new loss functions, pathway evaluations, and visualization utilities.
@BenjaminIsaac0111 BenjaminIsaac0111 merged commit 3891c38 into main Jun 9, 2026
2 checks passed
@BenjaminIsaac0111 BenjaminIsaac0111 deleted the feat/loss-functions-improvement branch June 9, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant