WideDeep¶
- Reference:
Heng-Tze Cheng et al. “Wide & Deep Learning for Recommender Systems.” in RecSys 2016.
-
class
recbole.model.context_aware_recommender.widedeep.
WideDeep
(config, dataset)[source]¶ Bases:
recbole.model.abstract_recommender.ContextRecommender
WideDeep is a context-based recommendation model. It jointly trains wide linear models and deep neural networks to combine the benefits of memorization and generalization for recommender systems. The wide component is a generalized linear model of the form \(y = w^Tx + b\). The deep component is a feed-forward neural network. The wide component and deep component are combined using a weighted sum of their output log odds as the prediction, which is then fed to one common logistic loss function for joint training.
-
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
-
forward
(interaction)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
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
-