Skip to content

Commit

Permalink
handle empty item lits
Browse files Browse the repository at this point in the history
  • Loading branch information
mdekstrand committed Feb 6, 2025
1 parent 71a69e2 commit aa74eb6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lenskit-implicit/lenskit/implicit.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def __call__(self, query: QueryInput, items: ItemList) -> ItemList:
if query.user_id is not None:
user_num = self.users_.number(query.user_id, missing=None)

if user_num is None:
if user_num is None or not len(items):
return ItemList(items, scores=np.nan)

inos = items.numbers(vocabulary=self.items_, missing="negative")
Expand Down

0 comments on commit aa74eb6

Please sign in to comment.