recbole.data.sequential_dataset¶
- class recbole.data.dataset.sequential_dataset.SequentialDataset(config)[source]¶
Bases:
recbole.data.dataset.dataset.DatasetSequentialDatasetis based onDataset, and provides augmentation interface to adapt to Sequential Recommendation, which can accelerate the data loader.- max_item_list_len¶
Max length of historical item list.
- Type
int
- item_list_length_field¶
Field name for item lists’ length.
- Type
str
- build()[source]¶
Processing dataset according to evaluation setting, including Group, Order and Split. See
EvalSettingfor details.- Parameters
eval_setting (
EvalSetting) – Object contains evaluation settings, which guide the data processing procedure.- Returns
List of built
Dataset.- Return type
list
- data_augmentation()[source]¶
Augmentation processing for sequential dataset.
E.g.,
u1has purchase sequence<i1, i2, i3, i4>, then after augmentation, we will generate three cases.u1, <i1> | i2(Which means given user_id
u1and item_seq<i1>, we need to predict the next itemi2.)The other cases are below:
u1, <i1, i2> | i3u1, <i1, i2, i3> | i4
- inter_matrix(form='coo', value_field=None)[source]¶
Get sparse matrix that describe interactions between user_id and item_id. Sparse matrix has shape (user_num, item_num). For a row of <src, tgt>,
matrix[src, tgt] = 1ifvalue_fieldisNone, elsematrix[src, tgt] = self.inter_feat[src, tgt].- Parameters
form (str, optional) – Sparse matrix format. Defaults to
coo.value_field (str, optional) – Data of sparse matrix, which should exist in
df_feat. Defaults toNone.
- Returns
Sparse matrix in form
cooorcsr.- Return type
scipy.sparse