Skip to content

commit fix to prevent nan coefficients from propagating into valid contrasts - #294

Merged
vbrennsteiner merged 2 commits into
mainfrom
missing_condition_fix
Sep 24, 2026
Merged

vbrennsteiner merged 2 commits into
mainfrom
missing_condition_fix

Conversation

@vbrennsteiner

Copy link
Copy Markdown
Collaborator

Purpose of this PR

In the current implementation, when the contrast matrix C is multiplied with B_cond, a NaN coefficient caused every contrast of the feature to go to NaN, even in features where the other conditions are fully observed. This goes back to the matrix multiplication, where operations like (1 * 20.1) + (-1 * 22.5) + (0 * NaN) would set 0 * NaN = NaN, and subsequently 20.1 - 22.5 + NaN = NaN. What should happen is (1 * 20.1) + (-1 * 22.5) + (0 * NaN) = 20.1 - 22.5, which is now the case by zero-filling the nan coefficients and setting the respective contrasts back to nan later.

@vbrennsteiner vbrennsteiner self-assigned this Sep 22, 2026
@vbrennsteiner vbrennsteiner added the bug Something isn't working label Sep 22, 2026
Comment thread src/alphapepttools/tl/diff_exp/ebayes.py Outdated
Comment thread src/alphapepttools/tl/diff_exp/ebayes.py Outdated
Comment thread src/alphapepttools/tl/diff_exp/ebayes.py Outdated
Comment thread src/alphapepttools/tl/diff_exp/ebayes.py Outdated
Comment thread src/alphapepttools/tl/diff_exp/ebayes.py Outdated
Comment thread tests/tl/test_diff_exp.py
@vbrennsteiner
vbrennsteiner merged commit d191e12 into main Sep 24, 2026
14 checks passed
@vbrennsteiner
vbrennsteiner deleted the missing_condition_fix branch September 24, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants