Provided we have a rating from 1-5, we could calculate the similarity of 2 users with:
For all recipes both users have rated, calculate the difference between the ratings, add a factor X and divide it by the number of recipes plus a factor Y.
The lower the similarity the closer the ratings of the 2 users are. Ranging from 0 to 4.
Factor X & Y in this case are used as a bias. Basically we say, the users have already voted on Y recipes and are in the middle for those. E. g. 10 recipes were one voted 2 and the other voted 4. That is to distinguish between users that have voted the same for one reciped and those that have voted the same for two recipes.
Examples:
Recipe A: User A 1, User B 1, User C * 1
Recipe B: User A 1, User B 1
If we don't use a bias we have:
A to B: ((1-1)+(1-1))/2 = 0
A to C: ((1-1))/1 = 0
With bias (X=2*10=20, Y=10):
A to B: ((1-1)+(1-1)+20)/(2+10) = 20/12 = 1.67
A to C: ((1-1)+20)/(1+10) = 20/11 = 1.81
Side note: I would do something like this also for calculating the recipe rating, so one 5 star rating can not push a recipe to the top. Not sure if I would want to display that rating or only use it for sorting though.
Provided we have a rating from 1-5, we could calculate the similarity of 2 users with:
For all recipes both users have rated, calculate the difference between the ratings, add a factor X and divide it by the number of recipes plus a factor Y.
The lower the similarity the closer the ratings of the 2 users are. Ranging from 0 to 4.
Factor X & Y in this case are used as a bias. Basically we say, the users have already voted on Y recipes and are in the middle for those. E. g. 10 recipes were one voted 2 and the other voted 4. That is to distinguish between users that have voted the same for one reciped and those that have voted the same for two recipes.
Examples:
If we don't use a bias we have:
With bias (X=2*10=20, Y=10):
Side note: I would do something like this also for calculating the recipe rating, so one 5 star rating can not push a recipe to the top. Not sure if I would want to display that rating or only use it for sorting though.
This is only a starting point.