DiffRec¶
- Reference:
Wenjie Wang et al. “Diffusion Recommender Model.” in SIGIR 2023.
- Reference code:
- class recbole.model.general_recommender.ldiffrec.AutoEncoder(item_emb, n_cate, in_dims, out_dims, device, act_func, reparam=True, dropout=0.1)[source]¶
Bases:
torch.nn.modules.module.Module
Guassian Diffusion for large-scale recommendation.
- training: bool¶
- class recbole.model.general_recommender.ldiffrec.LDiffRec(config, dataset)[source]¶
Bases:
recbole.model.general_recommender.diffrec.DiffRec
L-DiffRec clusters items into groups, compresses the interaction vector over each group into a low-dimensional latent vector via a group-specific VAE, and conducts the forward and reverse diffusion processes in the latent space.
- calculate_loss(interaction)[source]¶
Calculate the training loss for a batch data.
- Parameters
interaction (Interaction) – Interaction class of the batch.
- Returns
Training loss, shape: []
- Return type
torch.Tensor
- full_sort_predict(interaction)[source]¶
full sort prediction function. Given users, calculate the scores between users and all candidate items.
- Parameters
interaction (Interaction) – Interaction class of the batch.
- Returns
Predicted scores for given users and all candidate items, shape: [n_batch_users * n_candidate_items]
- Return type
torch.Tensor
- predict(interaction)[source]¶
Predict the scores between users and items.
- Parameters
interaction (Interaction) – Interaction class of the batch.
- Returns
Predicted scores for given users and items, shape: [batch_size]
- Return type
torch.Tensor
- training: bool¶