ankane / disco

Recommendations for Ruby and Rails using collaborative filtering
MIT License
565 stars 11 forks source link

Global Item Rank #8

Closed theianjones closed 3 years ago

theianjones commented 3 years ago

This may be a question out of ignorance, but given ranking items with explicit feedback, is there a way to get disco to generate a global rank for all the items.

So basically "top 10 ranked items" given the factors that are produced.

Do the factors produced indicate rank without specifying an id?

Im wondering if a query like this makes sense:

    items.id
FROM
    items
WHERE
    items.neighbor_vector IS NOT NULL
ORDER BY
    items.neighbor_vector <-> CUBE (ARRAY [1, 1, 1, 1, 1, 1, 1, 1])
ankane commented 3 years ago

Hey @theianjones, you'd probably want to use Wilson score to generate overall top items (since you'll want to take into account both the average score and the number of times an item has been rated). https://github.com/instacart/wilson_score#star-ratings

Relevant read: https://www.evanmiller.org/how-not-to-sort-by-average-rating.html

theianjones commented 3 years ago

Awesome. Thanks for the suggestion!

Thanks for all the work you do. We use many of your gems over at egghead.io 😄

ankane commented 3 years ago

No problem. This seems like a useful feature for Disco, so will add it this weekend.

ankane commented 3 years ago

Just pushed a new release with a top_items method.

theianjones commented 3 years ago

Awesome! Im excited to take a look.