recbole.data.utils¶
- recbole.data.utils.create_dataset(config)[source]¶
Create dataset according to
config['model']
andconfig['MODEL_TYPE']
. Ifconfig['dataset_save_path']
file exists and itsconfig
of dataset is equal to currentconfig
of dataset. It will return the saved dataset inconfig['dataset_save_path']
.
- recbole.data.utils.create_samplers(config, dataset, built_datasets)[source]¶
Create sampler for training, validation and testing.
- Parameters
- Returns
train_sampler (AbstractSampler): The sampler for training.
valid_sampler (AbstractSampler): The sampler for validation.
test_sampler (AbstractSampler): The sampler for testing.
- Return type
tuple
- recbole.data.utils.data_preparation(config, dataset)[source]¶
Split the dataset by
config['[valid|test]_eval_args']
and create training, validation and test dataloader.Note
If we can load split dataloaders by
load_split_dataloaders()
, we will not create new split dataloaders.- 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_dataloader(config, phase: Literal['train', 'valid', 'test', 'evaluation'])[source]¶
Return a dataloader class according to
config
andphase
.- Parameters
config (Config) – An instance object of Config, used to record parameter information.
phase (str) – The stage of dataloader. It can only take 4 values: ‘train’, ‘valid’, ‘test’ or ‘evaluation’. Notes: ‘evaluation’ has been deprecated, please use ‘valid’ or ‘test’ instead.
- Returns
The dataloader class that meets the requirements in
config
andphase
.- Return type
type
- recbole.data.utils.load_split_dataloaders(config)[source]¶
Load split dataloaders if saved dataloaders exist and their
config
of dataset are the same as currentconfig
of dataset.- Parameters
config (Config) – An instance object of Config, used to record parameter information.
- Returns
The split dataloaders.
- Return type
dataloaders (tuple of AbstractDataLoader or None)