Fix laser_nll going inf when residues are fixed - #12
Open
ssiddhantsharma wants to merge 1 commit into
Open
Conversation
sample_sequences averages the per-residue NLL over all positions; fixed (fix_beta) positions carry a recorded probability of 0, so log10(0) sends the mean to inf for every design with a fixed residue. Average over the designed positions only (exclude chain_mask), and intersect the binding-site mask with the designed set. No behavior change when nothing is fixed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes
laser_nll/laser_bs_nllbecominginfwhenever--fixed-identity-residue-indicesis used.Why
In
sample_sequences, the per-design NLL is a mean over every residue:When residues are fixed (
fix_beta=True->chain_mask = self.fixed_rotamers), the clamped positions carry a recorded probability of 0, solog10(0)sends the mean to-infandnlltoinf. Every design with at least one fixed residue reportsinffor bothlaser_nllandlaser_bs_nll, andmean_laser_score/mean_laser_bs_scorefollow. The scores are meant to measure the quality of the designed sequence, so the clamped positions should not be in the average anyway.Fix
Average the NLL over the designed positions only (exclude
chain_mask), and intersect the binding-site mask with the designed set:With no fixed residues,
designedis all-True and behavior is unchanged.Testing
One-iteration run with four fixed residues, before vs after:
laser_nll = [inf, inf, ...],mean_laser_score = inflaser_nll = [0.365, 0.367],laser_bs_nll = [0.143, 0.126],mean_laser_score = 0.366The binding-site NLL being lower than the full-sequence NLL is the expected direction (interface positions are higher-confidence).
Scope
Only
run_nise_boltz2x.py(the LASErMPNN path).run_nise_boltz1x.pydoes not use this pattern and does not expose fixed-identity residues; the LigandMPNN variant computes its ownlmpnn_nllon a separate path and is out of scope here.