Integration of User- & Item-Features
See original GitHub issueHi,
I have a problem with integrating user- and item-features. After some research I now know that I have to concatenate my user/item-feature matrix with an identity matrix. After doing this, my user-matrix looks the following:
When I know integrate this matrix in csr-format into my model fit it with (user_features = my_features) export the top-N recommendation using the predict function (with user_features agian!) I get the following precision when evaluating it. The blue line here is without adding User_features!
What is going wrong there? 😦
My code looks like this:
NUM_COMPONENTS = 10
NUM_EPOCHS = 20
learn_rate = 0.02
NUM_THREADS = 10
model = LightFM(loss = 'bpr, no_components=NUM_COMPONENTS, learning_rate=learn_rate)
model.fit(train, epochs=NUM_EPOCHS, num_threads=10, user_features=user_features)
` after doing this I export the top-N for every User in my testset:
recommendations = list()
n_users, n_items = test.shape
for user_id in np.arrange(n_users):
scores = model.predict(user_id, np.arange(n_items), num_threads=10, user_features=user_features)
top_items_list = np.argsort(-scores)[:20].tolist()
productids = itemgetter(*top_items_list)(products)
userid = customers[user_id]
recommendations.append({'UserID': userid, 'Empfehlungen': productids, 'Scores': np.sort(scores)[::-1 [:20].tolist()})
Here customers are the real labels of the customers.
Issue Analytics
- State:
- Created 6 years ago
- Comments:11
Top Results From Across the Web
Using Customer and Product Features in Recommender ...
Assuming that extra user features have unique values per user and extra item features have a unique value per item, one can represent...
Read more >The 7 Variants of Matrix Factorization For Collaborative Filtering
A straightforward matrix factorization model maps both users and items to a joint latent factor space of dimensionality D — such that user-item...
Read more >Attribute-Aware Recommender System Based on ... - Frontiers
User -relevant attributes determine the characteristics of a user, such as “age,” “gender,” “education,” etc. In contrast, item-relevant ...
Read more >Recommender Systems Based on Collaborative Filtering ...
A CF system generates recommendations based on the relationships and similarities between users or items [17]. These relations are inferred from the user-item...
Read more >The anatomy of high-performance recommender systems
The basic models for recommender systems work with two kinds of data: user-item interactions, such as ratings and buying behavior, and attribute ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This looks fine, as far as I can tell. Try lowering the learning rate!
hi! I couldn’t understand one thing, after model.fit could I make model.predict for users_id which was’n in model fit? for example, I fit the model for user_id = [1,2,3] and I want make prediction for user_id=4, is it possible do it without retrain the model? p.s. of course there is no new user or item features for predicted user thanks for suggestion