Skip to content

Conversation

@stephprince
Copy link
Collaborator

@stephprince stephprince commented Mar 6, 2025

Motivation

The current version of the saxs loss calculation was not differentiable and the resulting tensor had no associated gradient function. For the saxs component to contribute to the gradient computation during backprop, I believe a differentiable histogram or equivalent replacement is needed.

I have added two options here with a couple of figures on how they compare to the original function.

image
image
image
image

How to test the behavior?

python train.py path/to/data path/to/output --use_saxs_loss_only

Checklist

  • Did you update CHANGELOG.md with your changes?
  • Have you checked our Contributing document?
  • Have you ensured the PR clearly describes the problem and the solution?
  • Is your contribution compliant with our coding style? This can be checked running ruff from the source directory.
  • Have you checked to ensure that there aren't other open Pull Requests for the same change?
  • Have you included the relevant issue number using "Fix #XXX" notation where XXX is the issue number? By including "Fix #XXX" you allow GitHub to close issue #XXX when the PR is merged.

@smallfishabc smallfishabc marked this pull request as ready for review March 7, 2025 00:08
@codecov
Copy link

codecov bot commented Mar 13, 2025

Codecov Report

Attention: Patch coverage is 76.27119% with 14 lines in your changes missing coverage. Please review.

Project coverage is 25.02%. Comparing base (9a2a41c) to head (6df9b3f).

Files with missing lines Patch % Lines
src/metfish/msa_model/utils/loss.py 57.14% 9 Missing ⚠️
tests/test_extract_seq.py 28.57% 5 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (9a2a41c) and HEAD (6df9b3f). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (9a2a41c) HEAD (6df9b3f)
2 1
Additional details and impacted files
@@             Coverage Diff             @@
##             main       #7       +/-   ##
===========================================
- Coverage   44.05%   25.02%   -19.04%     
===========================================
  Files           3        6        +3     
  Lines         227     1095      +868     
===========================================
+ Hits          100      274      +174     
- Misses        127      821      +694     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@stephprince stephprince merged commit e81f7db into main Mar 18, 2025
5 of 8 checks passed
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.

3 participants