Skip to content

Clarify or rename filter_items #43

Closed

Description

@thorbjornwolf

Hi, thanks for this nice package!

AlternatingLeastSquares.recommend has a parameter called filter_items, which, apart from the source code, does not have any documentation.

The same parameter is found in RecommenderBase, AnnoyAlternatingLeastSquares, and ItemItemRecommender.

Before reading the source, I thought it was a whitelist of items that the recommendation should select from (which suited my usecase), but as it turns out, it is a blacklist. So, I have a two suggestions I'd like to hear your thoughts on:

  1. Deprecate filter_items, and make a more descriptively named parameter such as skip_items, ignore_items, or item_blacklist.
  2. Put an explanation in the docstrings: filter_items: A list of items that should not be recommended.

I would think the second one is a no-brainer - of course it should be documented. The first one, however, is a bit more bold. Thoughts?

As another remark (should I move it to another issue?), the line if filter_items: such as here doesn't work with numpy arrays. I would suggest moving to if filter_items is not None: instead.

Activity

  1. benfred commented on Jul 11, 2017

    @benfred
    Owner

    Thanks for the feedback! I totally agree - the documentation here has been lacking, and we should have full docstrings for all the methods.

    I started on this a little today:64135cc .

    These docs are hosted at http:///implicit.readthedocs.io/en/latest/. While the docs still need fleshing out, all the common methods and parameters are now documented.

    I also agree that switching the filter_items logic to work with numpy arrays makes sense - I'll add that in soon.

  2. thorbjornwolf commented on Jul 11, 2017

    @thorbjornwolf
    Author

    Wow, very nice! This looks great :-) Thanks a bunch!

  3. dminovski0 commented on Oct 17, 2021

    @dminovski0

    Is it possible for the parameter filter_items to be added to the AlternatingLeastSquares.similar_items method, and a parameter named filter_users to be added to the AlternatingLeastSquares.similar_users method, so that the sent items and users are not returned?

  4. benfred commented on Oct 17, 2021

    @benfred
    Owner

    @dminovski0 - thats a good suggestion! I'm trying to clean up the API here a bit, and I've added it to the list of tasks on #481

  5. dminovski0 commented on Oct 17, 2021

    @dminovski0

    @benfred Thank you.

  6. linked a pull request that will close this issueApi refactor #494on Jan 3, 2022
  7. benfred commented on Jan 3, 2022

    @benfred
    Owner

    #481 implements both the filter_items for similar_items/similar_users as well as working with numpy arrays.

  8. P-Light commented on Feb 13, 2024

    @P-Light

    Hello! Can you explain how filter_items works? When I pass a list with item indices in similar_items method I get these indices with -inf weight. It is not filtering really

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