Example #1
0
 def sample_meta_test(self, ratio=0.75, fixed=None):
     fixed = fixed if fixed is not None else self.fixed
     if fixed and self.meta_test:
         return self.meta_test
     inner_train, inner_test = self._random_split(self.m_test_d, ratio)
     self.meta_test['in_train'] = IterDataLoader.from_dataset(
         inner_train, self.batch_size)
     self.meta_test['in_test'] = IterDataLoader.from_dataset(
         inner_test, self.batch_size)
     return self.meta_test
Example #2
0
 def sample_meta_test(self, n_sample=10, ratio=0.75, fixed=None):
     fixed = fixed if fixed is not None else self.fixed
     if fixed and self.meta_test:
         return self.meta_test
     m_test_sampled = self.m_test_d.class_sample(n_sample, preload=True)
     inner_train, inner_test = m_test_sampled.intra_class_split(ratio, True)
     self.meta_test['in_train'] = IterDataLoader.from_dataset(
         inner_train, self.batch_size)
     self.meta_test['in_test'] = IterDataLoader.from_dataset(
         inner_test, self.batch_size)
     return self.meta_test
Example #3
0
 def _get_wrapped_dataloader(self, dataset, batch_size):
     sampler = data.sampler.RandomSampler(dataset, replacement=True)
     loader = data.DataLoader(dataset,
                              batch_size=batch_size,
                              sampler=sampler)
     return IterDataLoader(loader)