3

I am trying to solve a problem of a dating site. Here is the problem

Each user of app will have some attributes - like the books he reads, movies he watches, music, TV show etc. These are defined top level attribute categories. Each of these categories can have any number of values. e.g. in books : Fountain Head, Love Story ...

Now, I need to match users based on profile attributes. Here is what I am planning to do :

Store the data with reverse indexing. i.f. Each of Fountain Head, Love Story etc is index key to set of users with that attribute.

When a new user joins, get the attributes of this user, find which index keys for this user, get all the users for these keys, bucket (or radix sort or similar sort) to sort on the basis of how many times a user in this merged list.

Is this good, bad, worse? Any other suggestions?

Thanks Ajay

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
Thoughtful Monkey
  • 648
  • 2
  • 10
  • 24

1 Answers1

8

The algorithm you described is not bad, although it uses a very simple notion of similarity between people.

Let us make it more adjustable, without creating a complicated matching criteria. Let's say people who like the same book are more similar than people who listen to the same music. The same goes with every interest. That is, similarity in different fields has different weights.

Like you said, you can keep a list for each interest (like a book, a song etc) to the people who have that in their profile. Then, say you want to find matches of guy g:

for each interest i in g's interests:
  for each person p in list of i
    if p and g have mismatching sexual preferences
      continue
    if p is already in g's match list
      g->match_list[p].score += i->match_weight
    else
      add p to g->match_list with score i->match_weight

sort g->match_list based on score

The choice of weights is not a simple task though. You would need a lot of psychology to get that right. Using your common sense however, you could get values that are not that far off.

In general, matching people is much more complicated than summing some scores. For example a certain set of matching interests may have more (or in some cases less) effect than the sum of them individually. Also, an interest in one may totally result in a rejection from the other no matter what other matching interest exists (Take two very similar people that one of them loves and the other hates twilight for example)

Shahbaz
  • 46,337
  • 19
  • 116
  • 182
  • Thanks Shahbaz. This helps. Can you suggest any other sophisticated algorithm for matching people based on various attributes? – Thoughtful Monkey May 08 '12 at 04:43
  • 1
    @AjayBansal, like I said, this goes in the field of psychology. Take a look at [this site](http://mashable.com/2011/07/13/match-com-equation/) for example to get an idea of how complicated you can make it. In my opinion, those algorithms are still very basic compared to how humans behave. You also may find something in scientific papers. – Shahbaz May 08 '12 at 08:40
  • @Shahbaz, could it be possible in a SQL query? – Shahid Karimi Sep 04 '15 at 09:26
  • @marthajames, I'm not an RDB expert, but I do see that it could. – Shahbaz Sep 04 '15 at 13:15