Hello,
I want to make cross validation ofr my dataset so I chose the skorch lib but it require to pass the X and Y explicitly but My train_data is Dataloader that returns image, caption, caption_lengths, video_length and I pass them to the model but how can I do this in skorch
I get this error when I pass only the data_loader
ValueError: Stratified CV requires explicitely passing a suitable y.
any Idea what should I do!
I’ve only just recently started familiarizing myself with Skorch, but it seems that calls to fit
or equivalent require passing y
explicitly. Skorch allows passing PyTorch Dataset
-classes directly but in turn requires the user to pass y=None
in conjunction with the Dataset
. Please see Skorch’s documentation for how they handle parameters passed to fit
method.
IMHO you should maybe refrain from passing a DataLoader
and instead let Skorch’s NeuralNet
take care of wrapping the Dataset
to a DataLoader
. See their quick tutorial here.
Cheers,
PN
1 Like
thank for your reply I also got this answer and it works machine learning - Passing tensorDataset or Dataloader to skorch - Stack Overflow