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.

Predict using user features

See original GitHub issue

Hello, I would like to ask how we can predict using user features instead of user ids. Because having user ids means that lightFM needs to train with that user first. However, if I use user features, I can use training data of user with similar features, and recommend similar items.

Both predict and predict_rank have require use ids. Is there any way I can use user features to predict instead? predict(user_ids, item_ids, item_features=None, user_features=None, num_threads=1) predict_rank(test_interactions, train_interactions=None, item_features=None, user_features=None, num_threads=1)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:5
  • Comments:10

github_iconTop GitHub Comments

11reactions
maciejkulacommented, Aug 23, 2017

You’re close. Remember, user and item ids are indices into their respective feature matrices. In this case, your item matrix has three rows, so you’d need to do:

predict(0, item_ids=[0, 1, 2], item_features=[11's features, 12's features, 13's features], user_features=[D.features])
4reactions
maciejkulacommented, Aug 14, 2017
  1. It is usually better to provide it, because then the model will be more expressive: it will be able to express preference for every individual user. But sometimes this is counterproductive (data is too sparse) or impossible: you want to always predict for new users for whom you have no historical data (cold start).
  2. Given the same features, predictions will be the same. It doesn’t matter which row it’s in: all that matters are the features in the row. If you use the identity matrix, this is of course impossible: every row is different.

Hope this helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature Selection : Identifying the best input features
The wrapper method searches for the best subset of input features to predict the target variable. It selects the features that provide the...
Read more >
Using Customer and Product Features in Recommender ...
The entire idea behind recommender systems is to predict, for the given pair of user and item, whether this user will be interested...
Read more >
How to use predicted features in prediction? - Cross Validated
I want to train my model with the feature of the carry over, but I'm not sure how I ... and then predict...
Read more >
How to Connect Model Input Data With Predictions for ...
How to Connect Model Input Data With Predictions for Machine Learning ... Fitting a model to a training dataset is so easy today...
Read more >
How to use a model to do predictions with Keras - ActiveState
Keras models can be used to detect trends and make predictions, using the model. · In this example, a model is created and...
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