recbole.data.dataloader.abstract_dataloader¶
- class recbole.data.dataloader.abstract_dataloader.AbstractDataLoader(config, dataset, sampler, shuffle=False)[source]¶
Bases:
DataLoader
AbstractDataLoader
is an abstract object which would return a batch of data which is loaded byInteraction
when it is iterated. And it is also the ancestor of all other dataloader.- Parameters:
- shuffle¶
If
True
, dataloader will shuffle before every epoch.- Type:
bool
- pr¶
Pointer of dataloader.
- Type:
int
- _batch_size¶
The max interaction number for all batch.
- Type:
int
- batch_size: int | None¶
- collate_fn()[source]¶
Collect the sampled index, and apply neg_sampling or other methods to get the final data.
- dataset: Dataset[T_co]¶
- drop_last: bool¶
- num_workers: int¶
- pin_memory: bool¶
- pin_memory_device: str¶
- prefetch_factor: int | None¶
- sampler: Sampler | Iterable¶
- set_batch_size(batch_size)[source]¶
Reset the batch_size of the dataloader, but it can’t be called when dataloader is being iterated.
- Parameters:
batch_size (int) – the new batch_size of dataloader.
- 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.abstract_dataloader.NegSampleDataLoader(config, dataset, sampler, shuffle=True)[source]¶
Bases:
AbstractDataLoader
NegSampleDataLoader
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:
- batch_size: int | None¶
- dataset: Dataset[T_co]¶
- drop_last: bool¶
- num_workers: int¶
- pin_memory: bool¶
- pin_memory_device: str¶
- prefetch_factor: int | None¶
- sampler: Sampler | Iterable¶
- timeout: float¶