recbole.data.dataloader.general_dataloader

class recbole.data.dataloader.general_dataloader.GeneralDataLoader(config, dataset, batch_size=1, dl_format=<InputType.POINTWISE: 1>, shuffle=False)[source]

Bases: recbole.data.dataloader.abstract_dataloader.AbstractDataLoader

GeneralDataLoader is used for general model and it just return the origin data.

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

  • dataset (Dataset) – The dataset 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 = 1
property pr_end

This property marks the end of dataloader.pr which is used in __next__().

class recbole.data.dataloader.general_dataloader.GeneralFullDataLoader(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, recbole.data.dataloader.abstract_dataloader.AbstractDataLoader

GeneralFullDataLoader is a general-dataloader with full sort. 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.

  • 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.

data_preprocess()[source]

Do neg-sampling before training/evaluation.

dl_type = 2
get_pos_len_list()[source]
Returns

Number of positive item for each user in a training/evaluating epoch.

Return type

np.ndarray or list

property pr_end

This property marks the end of dataloader.pr which is used in __next__().

class recbole.data.dataloader.general_dataloader.GeneralNegSampleDataLoader(config, dataset, sampler, neg_sample_args, batch_size=1, dl_format=<InputType.POINTWISE: 1>, shuffle=False)[source]

Bases: recbole.data.dataloader.neg_sample_mixin.NegSampleByMixin, recbole.data.dataloader.abstract_dataloader.AbstractDataLoader

GeneralNegSampleDataLoader is a general-dataloader with negative sampling. For the result of every batch, we permit that every positive interaction and its negative interaction must be in the same batch. Beside this, when it is in the evaluation stage, and evaluator is topk-like function, we also permit 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.

  • 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.

data_preprocess()[source]

Do neg-sampling before training/evaluation.

get_pos_len_list()[source]
Returns

Number of positive item for each user in a training/evaluating epoch.

Return type

np.ndarray or list

property pr_end

This property marks the end of dataloader.pr which is used in __next__().

setup()[source]

Do batch size adaptation.