recbole.data.utils¶
-
class
recbole.data.utils.
DLFriendlyAPI
[source]¶ Bases:
object
A Decorator class, which helps copying
Dataset
methods toDataLoader
.These methods are called DataLoader Friendly APIs.
E.g. if
train_data
is an object ofDataLoader
, andnum()
is a method ofDataset
, Cause it has been decorated,num()
can be called directly bytrain_data
.See the example of
set()
for details.-
dataloader_apis
¶ Register table that saves all the method names of DataLoader Friendly APIs.
- Type
set
-
-
recbole.data.utils.
create_dataset
(config)[source]¶ Create dataset according to
config['model']
andconfig['MODEL_TYPE']
.
-
recbole.data.utils.
data_preparation
(config, dataset, save=False)[source]¶ Split the dataset by
config['eval_setting']
and calldataloader_construct()
to create corresponding dataloader.- Parameters
- Returns
train_data (AbstractDataLoader): The dataloader for training.
valid_data (AbstractDataLoader): The dataloader for validation.
test_data (AbstractDataLoader): The dataloader for testing.
- Return type
tuple
-
recbole.data.utils.
get_data_loader
(name, config, neg_sample_args)[source]¶ Return a dataloader class according to
config
andeval_setting
.- Parameters
name (str) – The stage of dataloader. It can only take two values: ‘train’ or ‘evaluation’.
config (Config) – An instance object of Config, used to record parameter information.
neg_sample_args (dict) – Settings of negative sampling.
- Returns
The dataloader class that meets the requirements in
config
andeval_setting
.- Return type
type