Item similarity recommender with constraints (e.g not "movies", but "(action, romance) movies"?)

User 2070 | 7/1/2015, 4:02:53 PM

How can I create a recommendation where the set of items recommended is within certain side itemdata categories? I've reviewed the online documentation for gl.create and there is much info about how to include side itemdata and userdata, but none that addresses this. Example: - create model with side itemdata data = standard (user_id, item_id, rating tupple) sframe side item_data = (item_type_a, item_type_b, item_type_c, etc) (e.g. all item_ids map to 1 categorical type) m3 = gl.ranking_factorization_recommender.create(data,target='rating',item_id='item_id',item_data=item_type) Recommendation for new user (with no category constraints) is simple: m3.recommend(['new_user'])['item_id'] This returns list of recommended itemids, spanning all itemtype categories But: how can I create a "constrained recommendation" limited to a specific set of item_type categories? - m3.recommend(['new_user'))['item_id'] but limit the recommendations to items in, say, only (item_type_b or item_type_c)? The example in the user guide, 7.6, questions 12-14 is similar in spirit, but not applicable as there the recommender model is predicting category tags, where here the "tag" is side data. Any suggestions on how to proceed?


User 2070 | 7/1/2015, 4:57:06 PM

Of course, now that I've posted this, I just found the answer:

Making recommendations for specific users and items

In situations where you build a model for all of your users and items, you may wish to limit the recommendations for particular users based on known item attributes. For example, for US-based customers you may want to limit recommendations to US-based products. The following code sample restricts recommendations to a subset of users and items -- specifically those users and items whose value in the 'country' column is equal to "United States". country = 'United States' m.recommend(users=users['user_id'][users['country']==country].unique(), items=items['item_id'][items['country']==country])

User 1207 | 7/1/2015, 10:16:15 PM

Excellent -- glad to see you found the answer!

-- Hoyt