hopwise.model.general_recommender.random¶
Classes¶
Random is an fundamental model that recommends random items. |
Module Contents¶
- class hopwise.model.general_recommender.random.Random(config, dataset)¶
Bases:
hopwise.model.abstract_recommender.GeneralRecommenderRandom is an fundamental model that recommends random items.
- input_type¶
- type¶
- fake_loss¶
- forward()¶
- calculate_loss(interaction)¶
Calculate the training loss for a batch data.
- Parameters:
interaction (Interaction) – Interaction class of the batch.
- Returns:
Training loss, shape: []
- Return type:
torch.Tensor
- predict(interaction)¶
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
- full_sort_predict(interaction)¶
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