chemprop.data.samplers#
Classes#
A :class`SeededSampler` is a class for iterating through a dataset in a randomly seeded |
|
A |
Module Contents#
- class chemprop.data.samplers.SeededSampler(N, seed)[source]#
Bases:
torch.utils.data.SamplerA :class`SeededSampler` is a class for iterating through a dataset in a randomly seeded fashion
- Parameters:
N (int)
seed (int)
- idxs#
- rg#
- class chemprop.data.samplers.ClassBalanceSampler(Y, seed=None, shuffle=False)[source]#
Bases:
torch.utils.data.SamplerA
ClassBalanceSamplersamples data from aMolGraphDatasetsuch that positive and negative classes are equally sampled- Parameters:
dataset (MolGraphDataset) – the dataset from which to sample
seed (int) – the random seed to use for shuffling (only used when shuffle is True)
shuffle (bool, default=False) – whether to shuffle the data during sampling
Y (numpy.ndarray)
- shuffle = False#
- rg#
- pos_idxs#
- neg_idxs#
- length#