Simple Suggestion / Recommendation Algorithm

Dan.StackOverflow picture Dan.StackOverflow · Dec 4, 2009 · Viewed 9.8k times · Source

I am looking for a simple suggestion algorithm to implement in to my Web App. Much like Netflix, Amazon, etc... But simpler. I don't need teams of Phd's working to get a better suggestion metric.

So say I have:

  • User1 likes Object1.
  • User2 likes Object1 and Object2.

I want to suggest to User1 they might also like Object2.

I can obviously come up with something naive. I'm looking for something vetted and easily implemented.

Answer

Yann Schwartz picture Yann Schwartz · Dec 4, 2009

There are many simple and not so simple examples of suggestion algorithms in the excellent Programming Collective Intelligence

The Pearson correlation coefficient (a little dry Wikipedia article) can give pretty good results. Here's an implementation in Python and another in TSQL along with an interesting explanation of the algorithm.