lightfm icon indicating copy to clipboard operation
lightfm copied to clipboard

hybrid model inference with user features only no user id

Open AbDsML opened this issue 3 years ago • 0 comments

I appreciate the example in hybrid model in showing the difference in AUC. https://github.com/lyst/lightfm/blob/master/examples/stackexchange/hybrid_crossvalidated.ipynb

However, it would be very helpful if you could also show the difference in using user features only vs user features + user index for inference. I understand you're supposed to use 0 for user index for predicting with user features for new users. model.predict(0, np.arange(n_items), user_features=new_user_features). However, there are two ways of inputting data as noted in the build_user_feature function: (user id, [list of feature names]) or (user id, {feature name: feature weight}). So does that mean one should only provide (0,{feature name: feature weight}) (in my case) for inference for new user? I tried different ways. I'm getting identical recommendations for all new users. But I do get good recommendations if I provide user index with: model.predict(dataset.mapping()[1][indx], np.arange(n_items)) The whole point of training a hybrid model is to infer with user features only for new users. I'm confused on how to input the new user features into predict. Also the sample_recommendation function requires user_ids in the quick start notebook. https://github.com/lyst/lightfm/blob/master/examples/quickstart/quickstart.ipynb Is there a demo for inferencing user features only and no user_ids needed?
Can someone shed some light on this? This has been difficult for a few days now. Thank you!

AbDsML avatar Jul 15 '20 15:07 AbDsML