recbole.data.dataloader.general_dataloader

class recbole.data.dataloader.general_dataloader.FullSortEvalDataLoader(config, dataset, sampler, shuffle=False)[source]

Bases: recbole.data.dataloader.abstract_dataloader.AbstractDataLoader

FullSortEvalDataLoader is a dataloader for full-sort evaluation. In order to speed up calculation, this dataloader would only return then user part of interactions, positive items and used items. It would not return negative items.

Parameters
  • config (Config) – The config of dataloader.

  • dataset (Dataset) – The dataset of dataloader.

  • sampler (Sampler) – The sampler of dataloader.

  • shuffle (bool, optional) – Whether the dataloader will be shuffle after a round. Defaults to False.

batch_size: Optional[int]
collate_fn(index)[source]

Collect the sampled index, and apply neg_sampling or other methods to get the final data.

dataset: torch.utils.data.dataset.Dataset[torch.utils.data.dataloader.T_co]
drop_last: bool
num_workers: int
pin_memory: bool
pin_memory_device: str
prefetch_factor: int
sampler: Union[torch.utils.data.sampler.Sampler, Iterable]
timeout: float
update_config(config)[source]

Update configure of dataloader, such as batch_size, step etc.

Parameters

config (Config) – The new config of dataloader.

class recbole.data.dataloader.general_dataloader.NegSampleEvalDataLoader(config, dataset, sampler, shuffle=False)[source]

Bases: recbole.data.dataloader.abstract_dataloader.NegSampleDataLoader

NegSampleEvalDataLoader is a dataloader for neg-sampling evaluation. It is similar to TrainDataLoader which can generate negative items, and this dataloader also permits that all the interactions corresponding to each user are in the same batch and positive interactions are before negative interactions.

Parameters
  • config (Config) – The config of dataloader.

  • dataset (Dataset) – The dataset of dataloader.

  • sampler (Sampler) – The sampler of dataloader.

  • shuffle (bool, optional) – Whether the dataloader will be shuffle after a round. Defaults to False.

batch_size: Optional[int]
collate_fn(index)[source]

Collect the sampled index, and apply neg_sampling or other methods to get the final data.

dataset: torch.utils.data.dataset.Dataset[torch.utils.data.dataloader.T_co]
drop_last: bool
num_workers: int
pin_memory: bool
pin_memory_device: str
prefetch_factor: int
sampler: Union[torch.utils.data.sampler.Sampler, Iterable]
timeout: float
update_config(config)[source]

Update configure of dataloader, such as batch_size, step etc.

Parameters

config (Config) – The new config of dataloader.

class recbole.data.dataloader.general_dataloader.TrainDataLoader(config, dataset, sampler, shuffle=False)[source]

Bases: recbole.data.dataloader.abstract_dataloader.NegSampleDataLoader

TrainDataLoader is a dataloader for training. It can generate negative interaction when training_neg_sample_num is not zero. For the result of every batch, we permit that every positive interaction and its negative interaction must be in the same batch.

Parameters
  • config (Config) – The config of dataloader.

  • dataset (Dataset) – The dataset of dataloader.

  • sampler (Sampler) – The sampler of dataloader.

  • shuffle (bool, optional) – Whether the dataloader will be shuffle after a round. Defaults to False.

batch_size: Optional[int]
collate_fn(index)[source]

Collect the sampled index, and apply neg_sampling or other methods to get the final data.

dataset: torch.utils.data.dataset.Dataset[torch.utils.data.dataloader.T_co]
drop_last: bool
num_workers: int
pin_memory: bool
pin_memory_device: str
prefetch_factor: int
sampler: Union[torch.utils.data.sampler.Sampler, Iterable]
timeout: float
update_config(config)[source]

Update configure of dataloader, such as batch_size, step etc.

Parameters

config (Config) – The new config of dataloader.