Promising results! Yesterday I wrote about an idea I had, using Bayesian filtering (the statistical technique they use to detect spam) to personalize restaurant preferences.

My hypothesis was that reviewers with similar taste preferences to me would share a similar vocabulary that was markedly different from reviewers with opposing views. By dividing reviews into two groups (restaurants I liked and restaurants I didn’t like), I could use statistics to calculate the probability of the wording of a certain review being from a restaurant I liked, rather than one I didn’t. That’s the basics of Bayes.

I ran a small-scale test today, focusing only on diners. I scraped the 20 most recent five-star reviews from six diners I’ve eaten at multiple times, and split each review-set into an array of words. Two of these diners were from my hometown in Connecticut, two are in downtown Chicago, and two are in Hyde Park. I like 3/6 of them.

I used the convenient “bayes” package from NPM to train and run my model. I trained my model on two diners I love and one I hate, and I tested my model on two I hate and one I love. It was 100% effective at judging my preferences for the diners.

Out of curiosity, I also tried applying my model to two non-diner restaurants, but it guessed wrong both times. This result wasn’t entirely surprising. I used two intentionally confusing restaurants. One was mediocre but served very similar menu items to a diner. The other was pretty good, but served very different items.

I think this idea has a lot of promise, but the flawed judgments it made with those two restaurants emphasize the importance of having an adequate dataset on each user’s preferences, including an adequate variety of cuisines. If a user only shares his favorite diners, the model is going to have a very strong preference towards diners.