14 Replies - 2628 Views - Last Post: 02 August 2011 - 09:18 AM Rate Topic: -----

#1 thatgoogleguy  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 76
  • Joined: 26-May 11

PHP Match Making Algorithm

Posted 18 July 2011 - 08:30 AM

I'm trying to make a matchmaking algorithm for my site. Can anyone suggest what PHP functions to use or how to approach a matchmaking algorithm? I know I'm going to have about 10 variables to check against. I guess I shouldn't be complaining since I just found out that Google's search algorithm contains over 500 Million variables.

This post has been edited by thatgoogleguy: 18 July 2011 - 08:39 AM

Is This A Good Question/Topic? 0
  • +

Replies To: PHP Match Making Algorithm

#2 CTphpnwb  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 2992
  • Posts: 10,337
  • Joined: 08-August 08

Re: PHP Match Making Algorithm

Posted 18 July 2011 - 08:44 AM

What do you mean by matchmaking? Perhaps if you showed us what you've got so far...
Was This Post Helpful? 1
  • +
  • -

#3 Jstall  Icon User is offline

  • Lurker
  • member icon

Reputation: 434
  • View blog
  • Posts: 1,042
  • Joined: 08-March 09

Re: PHP Match Making Algorithm

Posted 18 July 2011 - 11:18 AM

If by matchmaking you mean associating users with one another that would depend largely on your database schema. Then it would be a question of writing the appropriate query.
Was This Post Helpful? 0
  • +
  • -

#4 thatgoogleguy  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 76
  • Joined: 26-May 11

Re: PHP Match Making Algorithm

Posted 18 July 2011 - 01:43 PM

I've got it covered now. It's all about the query (which in fact is an algorithm of retrieving data).
Was This Post Helpful? 0
  • +
  • -

#5 theseamusjames  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 27
  • Joined: 17-May 10

Re: PHP Match Making Algorithm

Posted 18 July 2011 - 04:32 PM

Just querying for exact matches is a pretty limited way to achieve what you're talking about. If you want to make your model a lot more effective, I'd suggest something like this:

1. Allow the user to specify some basics (i.e. gender, age range, location) - and require them to specify some part of that.
2. Query the table and pull all the user data for people that match the basics.
3. Parse through each result and generate a score for compatibility. ie. If you have some data that's ranked out of 10, for example, an exact match to a question is +10. For every point n away from an exact match, you add 10-n to the score. Hence, if my answer to a question was an 8 (Like, "On a scale of 1 to 10, how much do you like to drink beer?") and your answer was a 5, you would add 7 to the total compatibility score. Similarly, if your answer had been an 8 too, you would add 10 to the compatibility score.
4. Sort your results by highest compatibility score.

Now, if you have large data sets, like thousands and thousands of users, this would be extremely slow. There are a lot of things you could do to correct for that, like building tolerances into your query so you're only pulling things that are 1 or two points away from the users answers to things. You could also probably do some analysis to optimize your queries once you have some data and then build in some probability models to increase speed (ie. 90% of people who answer 8 on this question also answer 5 on this other question).
Was This Post Helpful? 1
  • +
  • -

#6 thatgoogleguy  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 76
  • Joined: 26-May 11

Re: PHP Match Making Algorithm

Posted 01 August 2011 - 03:19 PM

That's the exact method I used, except we plan on the site scaling to about 500,000 members by the end of next year so we're limited when it comes to system resources. I don't know of any other language I could to make the querying fasterr.
Was This Post Helpful? 0
  • +
  • -

#7 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 947
  • View blog
  • Posts: 2,355
  • Joined: 15-February 11

Re: PHP Match Making Algorithm

Posted 01 August 2011 - 05:53 PM

Databases were made to handle a lot of data so that won't be a problem. Match making is more mathematical calculations instead of string matching. In theseamusjames's post #3 would be a great example. You'll basically have to do trial and error to get the ranges just right.
Was This Post Helpful? 0
  • +
  • -

#8 thatgoogleguy  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 76
  • Joined: 26-May 11

Re: PHP Match Making Algorithm

Posted 01 August 2011 - 06:16 PM

Can you recommend any software or program to assist in creating this algorithm? Turning the code into PHP isn't a problem, but the initial development of the algorithm is going to take forever without the assistance of software. i own a student copy of Wolfram Mathematica for the term, but it's overly complicated.
Was This Post Helpful? -1
  • +
  • -

#9 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 947
  • View blog
  • Posts: 2,355
  • Joined: 15-February 11

Re: PHP Match Making Algorithm

Posted 01 August 2011 - 06:24 PM

You don't need a software to develop the algorithm for you. It's fairly simple.

If someone rates beer a possible 7 out of 10 and wine a 9 out of 10 that gives you a total of 16 out of 20. That's 80% when it comes to drinks. If another scored 9 for beer and 6 for wine then you got 75%. They're fairly compatible there.
Was This Post Helpful? 2
  • +
  • -

#10 thatgoogleguy  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 76
  • Joined: 26-May 11

Re: PHP Match Making Algorithm

Posted 01 August 2011 - 07:19 PM

Lol it's not that simple. If it were that simple I would already be rich. Thanks for the advice though. Myself and five other people are probably dealing with a beast of an algorithm probably out of our intellectual grasp for the time being. There's one reason to take up programming. Always learning.
Was This Post Helpful? 0
  • +
  • -

#11 maniacalsounds  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 117
  • View blog
  • Posts: 472
  • Joined: 27-June 10

Re: PHP Match Making Algorithm

Posted 01 August 2011 - 07:23 PM

It really shouldn't be that hard. I believe you're confusing length with difficulty. Just because some PHP code is long doesn't mean it's complex. All you're doing is a bunch of looping, with minute expressions in each. Just keep a running count. It's not incredibly difficult, it'll just take a little bit to gather all of the fields the first time, because you have to type a lot.
Was This Post Helpful? 1
  • +
  • -

#12 thatgoogleguy  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 76
  • Joined: 26-May 11

Re: PHP Match Making Algorithm

Posted 01 August 2011 - 07:34 PM

I guess that does make sense. Just deciding what we want to match users based upon and typing the program is going to take a while.
Was This Post Helpful? 0
  • +
  • -

#13 aaron1178  Icon User is offline

  • Dovakiin, Dragonborn
  • member icon

Reputation: 169
  • View blog
  • Posts: 1,298
  • Joined: 22-October 08

Re: PHP Match Making Algorithm

Posted 01 August 2011 - 10:16 PM

View PostJstall, on 19 July 2011 - 04:18 AM, said:

If by matchmaking you mean associating users with one another.


Haha very much like mark Zuckerbergs FaceSmash :)
Was This Post Helpful? 0
  • +
  • -

#14 Lemur  Icon User is offline

  • Pragmatism over Dogma
  • member icon


Reputation: 1368
  • View blog
  • Posts: 3,453
  • Joined: 28-November 09

Re: PHP Match Making Algorithm

Posted 02 August 2011 - 09:12 AM

Algorithms are a key part of programming knowledge. It's typically a part of the Junior level course load in College, and trust me, they do cover it extensively.
Was This Post Helpful? 0
  • +
  • -

#15 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10567
  • View blog
  • Posts: 39,121
  • Joined: 27-December 08

Re: PHP Match Making Algorithm

Posted 02 August 2011 - 09:18 AM

Really the algorithm you want to use here is basic statistics. What is the weight/emphasis placed on a category, and how many shared traits do two people have in that category? So just sum(numSimilaritiesInCategory * categoryWeight). The higher the score, the better the match.

Quote

Algorithms are a key part of programming knowledge. It's typically a part of the Junior level course load in College, and trust me, they do cover it extensively.

Those algorithms are more advanced though. A good definition of an algorithm I like is "a finite sequence of steps that produces a specific result." The algorithm for this shouldn't require the 3000 and 4000 level CS classes. :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1