jamesdolezal / slideflow

Deep learning library for digital pathology, with both Tensorflow and PyTorch support.
https://slideflow.dev
GNU General Public License v3.0
234 stars 39 forks source link

Bootstrap #333

Closed mnezaf closed 6 months ago

mnezaf commented 8 months ago

Feature

Using bootstrapping split for MIL model

Pitch

Thank you for the recent version, very helpful documenation! We are training attMIL model using kfold cross validation. We realized that there is a huge performance differences in between folds. We plan to try bootsrapping as well, but the training iteration just done once. Is there any way to specify the number of training and validation splits in bootstrap strategy? Thanks

Alternatives

Additional context

jamesdolezal commented 8 months ago

Hi! Yes, this is possible to do. Following Tutorial 8, you would replace the the following line:

train, val = dataset.split(labels='er_status_by_ihc', val_fraction=0.3)

with:

for _ in range(n_iterations):
    train, val = dataset.split(..., val_fraction=0.3)
    # Train MIL function with this bootstrap split

And that's it! That will perform boostrap validation n_iterations number of times.