You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So the als.recommend function takes an 'int' for userid and a 'coo_matrix' for item_user_data.T which is a coo_matrix, however you cannot index coo_matrix that way so it fails for me
In [46]: ratings
Out[46]:
<635810x14744082 sparse matrix of type '<class 'numpy.float64'>'
with 115307196 stored elements in COOrdinate format>
In [47]: model.recommend(5, ratings.T)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-46-2d2962f49703> in <module>()
----> 1 model.recommend(5, ratings.T)
/Users/ml/lib/python3.5/site-packages/implicit/als.py in recommend(self, userid, user_items, N)
87
88 # calcualte the top N items, removing the users own liked items from the results
---> 89 liked = set(user_items[userid].indices)
90 count = N + len(liked)
91 if count < len(scores):
TypeError: 'coo_matrix' object does not support indexing
If not a coo_matrix what should I pass to the recommend function?
The text was updated successfully, but these errors were encountered:
It should be a CSR matrix - I'll add some documentation this weekend to clear up, but something like 'model.recommend(5, ratings.T.tocsr())' should work.
So the als.recommend function takes an 'int' for userid and a 'coo_matrix' for item_user_data.T which is a coo_matrix, however you cannot index coo_matrix that way so it fails for me
If not a coo_matrix what should I pass to the recommend function?
The text was updated successfully, but these errors were encountered: