Skip to content

getting index error while using recommend function while ALS algorithm #708

Description

@abhinav221294

model.recommend(user_label, sparse_user_items[user_label])


IndexError Traceback (most recent call last)
Cell In[33], line 1
----> 1 model.recommend(user_label, sparse_user_items[user_label])

File ~\anaconda3\Lib\site-packages\implicit\cpu\matrix_factorization_base.py:79, in MatrixFactorizationBase.recommend(self, userid, user_items, N, filter_already_liked_items, filter_items, recalculate_user, items)
76 if items is not None:
77 filter_query_items = _filter_items_from_sparse_matrix(items, filter_query_items)
---> 79 ids, scores = topk(
80 item_factors,
81 user,
82 N,
83 filter_query_items=filter_query_items,
84 filter_items=filter_items,
85 num_threads=self.num_threads,
86 )
88 if np.isscalar(userid):
89 ids, scores = ids[0], scores[0]

File topk.pyx:32, in implicit.cpu.topk.topk()

File topk.pyx:54, in implicit.cpu.topk._topk_batch()

IndexError: index 977 is out of bounds for axis 1 with size 944

for the reference: #535

Activity

  1. mandanafasounaki commented on Nov 19, 2024

    @mandanafasounaki

    Same issue here

  2. reese60525 commented on Dec 18, 2024

    @reese60525

    Same issue here

  3. sjain-ajc commented on Apr 22, 2025

    @sjain-ajc

    Same issue here

  4. Lazyyx commented on May 16, 2025

    @Lazyyx

    Did someone find a solution ? I'm stuck with the same error :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions