Recommender engine in python - incorporate custom similarity metrics
<p>I am currently building a recommender engine in python and I faced the following problem.</p>

<p>I want to incorporate collaborative filtering approach, its user-user variant. To recap, its idea is that we have an information on different users and which items they liked (if applicable - which ratings these users assigned to items). When we have new user who liked couple of things we just find users who liked same items and recommend to this new user items which were liked by users similar to new user.</p>

<p>But I want to add some twist to it. I will be recommending places to users, namely 'where to go tonight'. I know user preferences, but I want to also incorporate the distance to each item I could recommend. The father the place I am going to recommend to the user - the least attractive it should be.</p>

<p>So in general I want to incorporate a penalty into recommendation engine and the amount of penalty for each place will be based on the distance from user to the place.</p>

<p>I tried to googleif anyone did something similar but wasn't able to find anything. Any advice on how to properly add such penalty? </p>

<p>I would keep it simple and separate:</p>

<p>Your focus is collaborative filtering, so your recommender should generate scores for the top N recommendations <em>regardless of location</em>.</p>

<p>Then you can <strong>re-score</strong> using distance among those top-N.  For a simple MVP, you could start with an inverse distance decay (e.g. <code>final-score = cf-score * 1/distance</code>), and adjust the decay function based on behavioral evidence if necessary.</p>

python machine-learning recommendation-engine data-science