question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] How I can access user-items predictions and actuals?

See original GitHub issue

I’m trying to understand how to get all users from my test dataset with the corresponding predicted items per each user? I use RecVAE model and when I get top items like that:

def run_predict(model, test_data, device, k):
    item_tensor = test_data.dataset.get_item_feature().to(device).repeat(test_data.step)
    tot_item_num = test_data.dataset.item_num
    topk_list = []
    for batched_data in test_data:
        interaction, history_index, *_ = batched_data
        try:
            scores = model.full_sort_predict(interaction.to(device))
        except NotImplementedError:
            new_inter = interaction.to(
                device).repeat_interleave(tot_item_num)
            batch_size = len(new_inter)
            new_inter.update(item_tensor[:batch_size])
            scores = model.predict(new_inter)
        scores = scores.view(-1, tot_item_num)
        scores[:, 0] = -np.inf
        if history_index is not None:
            scores[history_index] = -np.inf
        topk_list.append(torch.topk(scores, k=k)[1])
    topk_items = torch.cat(topk_list, dim=0).unique()
    topk_items = topk_items.cpu().numpy()

    return topk_items

it returns just items which doesn’t correspond to number of users I have in test_data.dataset.user_num So I’m a little lost, how would I see user per each of these topk_items predictions? And how to access initial items for each user from test data?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
AsyaEvloevacommented, Nov 24, 2021

thank you for this example!! now i get it😁

I’m looking not for a cold start problem solution, but more about recommendations for new users with provided interaction records. so if i’m using RecVAE model, is there any already-built possibility to update dataset with such new records and continue training model and making predictions on such updated dataset?

0reactions
Sherry-XLLcommented, Nov 25, 2021

@AsyaEvloeva Sorry, we don’t have such an interface at present.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Connect Model Input Data With Predictions for ...
In this case, we will use a simple two-class or binary classification problem with two numerical input variables.
Read more >
Use predicted or actual values for 'unknown' independent ...
When performing linear regression for the sake of prediction, I am left with the conundrum of whether I should use the actual values...
Read more >
A Comprehensive Guide on How to Monitor Your Models in ...
Use unsupervised learning methods to categorize model inputs and predictions, allowing you to discover cohorts of anomalous examples andĀ ...
Read more >
Manage Google autocomplete predictions - Google Search Help
With autocomplete, you can enter a Google search more quickly. You can turn off or remove certain autocomplete predictions or report issues with...
Read more >
Making Predictions with Regression Analysis - Statistics By Jim
In this post, I show how to use regression analysis to make predictions and determine whether they are both unbiased and precise. You...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found