Repository navigation
Soft-responsibility imputation, posterior variance, and sparse dropout simulation (#564) - #571
Merged
Merged
Conversation
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.
Closes #564.
Builds on the observed-only marginalization already landed in #568 (
_estimate_observed_gaussian_log_prob, observed-only_m_step/_fit_emeans, and removal ofSoftImputepre-imputation).Summary
ddmc/clustering.py):DDMC.impute(mode="soft", return_var=False)to default to posterior expectation imputation $\hat{X}{ij} = \sum{c=1}^k \gamma_{ic} \mu_{cj}$ (mode="soft"), while preserving hard cluster-center assignment viamode="hard".return_var=Trueto return posterior predictive variances (0.0for observed entries, law of total variance $\sum_{c=1}^k \gamma_{ic} (\sigma_{cj}^2 + \mu_{cj}^2) - \hat{X}{ij}^2$ formode="soft", and $\sigma{c^*, j}^2$ formode="hard").ddmc/datasets.py):simulate_dropout(p_signal, missing_fraction, mechanism="mcar", col_groups=None, random_state=None)supporting"mcar", intensity-dependent"mnar"(limit-of-detection), and"block"(MS run / spatial ROI) dropout.ddmc/tests/test_sparse_imputation.py):"mcar","mnar", and"block"dropout behaviors and input validation.DDMCwith observed-only marginalization and a sequence prior (seq_weight > 0) achieves higher cluster recovery (ARI > 0.85) and lower held-out reconstruction MSE thanDDMC(seq_weight=0.0)and column-mean imputation.Verification
uv run ruff format --check ddmc: 32 files already formatteduv run ruff check ddmc: All checks passeduv run ty check ddmc: All checks passeduv run pytest -v: 82 passed