Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First draft for KFold #684

Draft
wants to merge 3 commits into
base: clinicadl_v2
Choose a base branch
from

Conversation

thibaultdvx
Copy link
Collaborator

Here is a first draft for KFold.

At initialization, KFold takes one or several CapsDataset (e.g. KFold(dataset) or KFold(dataset_0, dataset_1)).
The public methods are:

  • make_splits: to perform the splitting operation. This method should do the job of clinicadl kfold;
  • read: to get the splits from a split directory;
  • write: after make_splits has been called, to write the splits in a split directory;
  • get_splits: returns an iterator of the wanted splits (e.g. kfold.get_splits(splits=[0, 3])).

The splits are returned as a Split object that contains all the relevant information for training, including the training and validation datasets. If multiple datasets have been passed at the initialization of the KFold object, a tuple of Split objects is returned (splits are arranged according to the order of input datasets).

To build the associated training and validation dataloaders, the user must call the build_train_loader and build_val_loader methods of the Split objects. These methods accept common dataloader parameters (batch_size, shuffle, etc.). I chose to separate these two methods because the user may want different parameters for his/her training and validation loaders.

I also felt the need to refactor the get_dataloader and generate_sampler functions.

Beware that it is a draft and nothing is yet tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant