Feat(MicroSplit API): next-gen MicroSplit#972
Open
jdeschamps wants to merge 5 commits into
Open
Conversation
## Disclaimer - [ ] I am an AI agent. - [x] I have used AI and I thoroughly reviewed every line. - [ ] I have not used AI extensively. ## Description > [!NOTE] > **tldr**: Refactor MicroSplit noise-model and loss configuration, replacing > fragmented likelihood configs with a unified logic. ### Background - why do we need this PR? The previous implementation spread noise-model related code across 3 separate Pydantic models (`GaussianLikelihoodConfig`, `NMLikelihoodConfig`, and `MultiChannelNMConfig`), three loss types (`musplit`, `denoisplit`, `denoisplit_musplit`), and multiple `VAEModule` attributes (`gaussian_likelihood`, `noise_model_likelihood`). This made it hard to reason about which combination of configs was valid, made code very hard to read and error prone. ### Overview - what changed? - Likelihood configuration objects are removed; their parameters live directly in `LVAELossConfig`. - `predict_logvar` is now a plain `bool` everywhere (was `Literal[None, "pixelwise"]`). - `GaussianMixtureNMConfig` exposes a `from_npz` classmethod instead of accepting a `path` field that triggered side-effectful validation.(That is questionable and likely to be changed) - `VAEModule` holds data statistics directly and passes them into the loss function, removing the intermediary likelihood objects. - `NoiseModelTrainer` is added(Not yet used). - musplit_loss, denoisplit_loss, and denoisplit_musplit_loss are replaced by a single microsplit_loss, controlled by `musplit_weight` / `denoisplit_weight`.. The SupportedLoss enum retains only hdn and microsplit. Performance tested on a subset of ht_lif24 ### Please ensure your PR meets the following requirements: - [x] Code builds and passes tests locally, including doctests - [x] New tests have been added (for bug fixes/features) - [ ] Pre-commit passes - [ ] PR to the documentation exists (for bug fixes / features) --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Vera Galinova <32124316+veegalinova@users.noreply.github.com> Co-authored-by: Joran Deschamps <6367888+jdeschamps@users.noreply.github.com>
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.
MSplit refactoring compatible with CAREamics
v0.2.