LKPY collaborative-filtering

27 views
Skip to first unread message

Márcia Barros

unread,
Feb 6, 2019, 5:25:24 AM2/6/19
to LensKit Recommender Toolkit Development and Support
Hi, 

I'm thinking of using LKPY to see how a new dataset behaves with basic recommender algorithms.
I'm trying to use, for example, lenskit.algorithms.user_knn.UserUser, and I would like to know if it is possible to select the similarity function used to calculate the similarity between users.

For what I've read, the default is cosine similarity, but would it be possible to user for example Pearson Correlation or others?

Best Regards, 
Márcia Barros 

Michael Ekstrand

unread,
Feb 6, 2019, 10:52:32 AM2/6/19
to Márcia Barros, LensKit Recommender Toolkit Development and Support
Márcia,

It is not currently possible to change the similarity function. Hard-wiring the cosine similarity into the algorithm gives us substantial performance benefits, and the utility of other similarity functions is debatable.

In particular, computing cosine similarity over user-centered rating vectors is equivalent to Pearson correlation when both users have rated the same set of items, and when they have not, it works very similarly to significance weighting. In fact, I prefer it to significance weighting because it is parameter-free. Details are here: https://grouplens.org/blog/similarity-functions-for-user-user-collaborative-filtering/

If you do actually need the Pearson correlation, you either need to copy & modify the UserKNN source code, or use the old Java LensKit. I would entertain a pull request that adds generalized neighborhood algorithms, provided we retain the fast-path for the common case of cosine similarity.

- Michael

--
You received this message because you are subscribed to the Google Groups "LensKit Recommender Toolkit Development and Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lenskit-recsy...@googlegroups.com.
To post to this group, send email to lenskit...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lenskit-recsys/b5eb4601-d244-4d0d-84bf-66c081a69592%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Michael D. Ekstrand — michael...@boisestate.edu https://md.ekstrandom.net
Assistant Professor, Dept. of Computer Science, Boise State University
People and Information Research Team (PIReT)  http://coen.boisestate.edu/piret/
Reply all
Reply to author
Forward
0 new messages