On Fri, Sep 20, 2002 at 08:46:27AM +0100, Simon Wistow wrote: > For reasons best left to my own imagination I'm looking to do something > that will show an average rating for a object based on all submitted > ratings but also do a "if you liked this then you'd also like ...". > > So, anybody got any smart ideas on how to do it. I wondered about Markov > Chains but they have a concept of order as far as I know. Am I > overengineering? Is there some really simple way of doing this?
My psuedo-SQL is very rusty, but given a reasonable DBMS one can surely do somthing like this: Get the average score for this item: select arithmetic_mean(score) from rating where item = $current_item People who liked this also liked: select item from rating where score > $hi_score_threshold and user in (select user from rating where score > $hi_score_threshold and item = $current_item)