recbole.utils.case_study¶
-
recbole.utils.case_study.
full_sort_scores
(uid_series, model, test_data)[source]¶ Calculate the scores of all items for each user in uid_series.
Note
The score of [pad] and history items will be set into -inf.
- Parameters
uid_series (numpy.ndarray) – User id series
model (AbstractRecommender) – Model to predict
test_data (AbstractDataLoader) – The test_data of model
- Returns
the scores of all items for each user in uid_series.
- Return type
torch.Tensor
-
recbole.utils.case_study.
full_sort_topk
(uid_series, model, test_data, k)[source]¶ Calculate the top-k items’ scores and ids for each user in uid_series.
- Parameters
uid_series (numpy.ndarray) – User id series
model (AbstractRecommender) – Model to predict
test_data (AbstractDataLoader) – The test_data of model
k (int) – The top-k items.
- Returns
topk_scores (torch.Tensor): The scores of topk items.
topk_index (torch.Tensor): The index of topk items, which is also the internal ids of items.
- Return type
tuple