docs(tutorial 3): document ABMIL fixed-size patch sampling strategy#210
Open
sammargolis wants to merge 1 commit into
Open
docs(tutorial 3): document ABMIL fixed-size patch sampling strategy#210sammargolis wants to merge 1 commit into
sammargolis wants to merge 1 commit into
Conversation
Addresses issue mahmoodlab#115 by explaining why patches are randomly sampled during training but all patches are used at val/test time. Adds a callout block in the markdown and a docstring + inline comments to H5Dataset clarifying the regularization rationale, memory benefits, and the GigaPath position-encoding caveat. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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.
Summary
Closes #115.
This PR adds documentation to Tutorial 3 explaining the intentional design choice of randomly sampling a fixed number of patches per slide during training, while using all patches at validation/test time.
Changes
tutorials/3-Training-a-WSI-Classification-Model-with-ABMIL-and-Heatmaps.ipynbbatch_size > 1, patch diversity across epochs)H5Dataset.__init__documenting thenum_featuresparameter and the train vs. eval behavior__getitem__sampling block to make the train/test asymmetry self-evidentMotivation
Issue #115 raised a good question about whether the fixed-size random sampling used during ABMIL training could cause the model to miss important patches. The answer (already explained clearly by @ajv012 in the issue thread) is well-established in the MIL literature but was not surfaced anywhere in the tutorial code. Readers following the tutorial would encounter the sampling logic with no indication that it is intentional, why it is beneficial, or what its limitations are.
Test plan