vendredi 22 mars 2019

What're some of the efficient ways to calculate and store the relative relating between users?

Here's how my application should work:

Users need to select an answer(s) from a list of questions. And based on those answers, for each user we need to find the score for every other user. Basically, we need to find the similarity between every singe user and then suggest those users that are most similar to a given user. So for example the questions can be:

Q1. Choose one color among ["red", "yellow", "blue"]
Q2. Choose movie(s) among ["x", "y", "z"]
Q3. Height in inches

The application is supposed to be like Tinder where users fill up their profile and are suggested a bunch of users whom they can like or dislike. But instead of using some ML recommendation algorithm, there're a predefined set of rules.

Scoring rules are kind of similar to these

  1. If two users have same choice of color score +50
  2. If two users have same choice of movies then score +100 for each match
  3. If height difference < 0.5, score +50 else score +10

This is where I am stuck

  1. How do I calculate the relative rating ? The obvious and the most naive way would be to fetch every user and then run a nested loop and calculate the score. Every time a new user register or an existing user updates his/her profile, the loop needs to run again. The expected users for this application is in thousands so obviously this method is not an option.

  2. How do I store the scores ? I am using mongodb.

Thank you !

Aucun commentaire:

Enregistrer un commentaire