recbole.data.dataloader.neg_sample_mixin¶
-
class
recbole.data.dataloader.neg_sample_mixin.
NegSampleByMixin
(config, dataset, sampler, neg_sample_args, batch_size=1, dl_format=<InputType.POINTWISE: 1>, shuffle=False)[source]¶ Bases:
recbole.data.dataloader.neg_sample_mixin.NegSampleMixin
NegSampleByMixin
is an abstract class which can sample negative examples by ratio. It has two neg-sampling method, the one is 1-by-1 neg-sampling (pair wise), and the other is 1-by-multi neg-sampling (point wise).- Parameters
config (Config) – The config of dataloader.
dataset (Dataset) – The dataset of dataloader.
sampler (Sampler) – The sampler of dataloader.
neg_sample_args (dict) – The neg_sample_args of dataloader.
batch_size (int, optional) – The batch_size of dataloader. Defaults to
1
.dl_format (InputType, optional) – The input type of dataloader. Defaults to
POINTWISE
.shuffle (bool, optional) – Whether the dataloader will be shuffle after a round. Defaults to
False
.
-
class
recbole.data.dataloader.neg_sample_mixin.
NegSampleMixin
(config, dataset, sampler, neg_sample_args, batch_size=1, dl_format=<InputType.POINTWISE: 1>, shuffle=False)[source]¶ Bases:
recbole.data.dataloader.abstract_dataloader.AbstractDataLoader
NegSampleMixin
is a abstract class, all dataloaders that need negative sampling should inherit this class. This class provides some necessary parameters and method for negative sampling, such asneg_sample_args
and_neg_sampling()
and so on.- Parameters
config (Config) – The config of dataloader.
dataset (Dataset) – The dataset of dataloader.
sampler (Sampler) – The sampler of dataloader.
neg_sample_args (dict) – The neg_sample_args of dataloader.
batch_size (int, optional) – The batch_size of dataloader. Defaults to
1
.dl_format (InputType, optional) – The input type of dataloader. Defaults to
POINTWISE
.shuffle (bool, optional) – Whether the dataloader will be shuffle after a round. Defaults to
False
.
-
dl_type
= 3¶