Hallo, ich bin Christian Rudder und ich bin Mitbegründer von OKCupid. Heute ist es eine der größten Dating-Sites in den USA. Wie fast jeder dort habe ich Mathe studiert und erwartungsgemäß sind wir für unseren analytischen Ansatz zur Liebe bekannt. Wir nennen es unseren Treffer-Algorithmus. OKCupids Treffer-Algorithmus hilft uns bei der Entscheidung, ob zwei Leute sich verabreden sollten. Darauf haben wir unser ganzes Geschäft aufgebaut. "Algorithmus" klingt hochtrabend, und Leute meinen, es sei eine große Sache, aber in Wahrheit ist es nur ein Konzept, wie man Schritt für Schritt ein Problem lösen kann. Er muss gar nicht hochtrabend sein. Ich werde jetzt erklären, wie wir auf unseren speziellen Algorithmus gekommen sind, damit ihr seht, wie das funktioniert. Warum sind Algorithmen überhaupt wichtig? Warum gibt es diese Lektion überhaupt? Vorhin habe ich einen wichtigen Satz gesagt: Mit ihnen kann man Schritt für Schritt ein Problem lösen, und bekanntermaßen sind Computer dabei einsame Spitze. Ein Computer ohne Algorithmus ist im Grunde ein teurer Briefbeschwerer. Da Computer in unserem Leben allgegenwärtig sind, sind es auch Algorithmen. Die Mathematik hinter OKCupids Treffer-Algorithmus ist überraschend einfach. Es sind nur ein paar Additionen, Multiplikationen und ein paar Quadratwurzeln. Die Herausforderung dabei war, herauszufinden, wie man etwas Geheimnisvolles – menschliche Anziehungskraft – für einen Computer in "mundgerechte " Stücke aufsplitten kann. Zunächst brauchten wir Daten, um Menschen zusammen zu bringen. Etwas, womit der Algorithmus arbeiten kann. Am schnellsten bekommt man Daten von Menschen, wenn man einfach darum bittet. Wir beschlossen, dass OKCupid Anwender einfach fragen sollte, z. B. "Willst du einmal Kinder haben?" und "Wie oft putzt du deine Zähne?", "Magst du unheimliche Filme?" und große Fragen wie "Glaubst du an Gott?" Viele dieser Fragen eignen sich gut dafür, ähnliche Menschen zusammenzuführen, das heißt, wenn Menschen die gleichen Antworten geben. Wenn z. B. alle beide unheimliche Filme mögen, passen sie vielleicht besser zusammen als zwei Menschen, von denen sie nur einer mag. Aber was ist z. B. mit Fragen wie: "Stehst du gerne im Mittelpunkt?" Wenn beide Partner dies bejahen, dann werden sie massive Probleme haben. Das haben wir schnell bemerkt, also wollten wir zu jeder Frage weitere Daten haben. Wir baten Menschen, nicht nur ihre eigene Antwort zu geben, sondern auch die Antwort, die sie sich vom anderen wünschen. Das funktionierte sehr gut, aber wir benötigten eine weitere Dimension. Manche Fragen verraten mehr über einen Menschen als andere. Eine Frage über Politik wie "Was ist schlimmer: Bücher oder Flaggen zu verbrennen?" kann mehr über jemanden verraten als sein Filmgeschmack. Es ist auch sinnlos, alles gleich zu gewichten, also haben wir noch etwas hinzugefügt. Bei jeder Frage von OKCupid kannst du angeben, welche Rolle sie in deinem Leben spielt, auf einer Skala von "unwichtig" bis "ein Muss". Bei jeder Frage erhalten wir 3 Dinge für unseren Algorithmus: Erstens, deine Antwort, zweitens, wie jemand anders – der potentielle Treffer – antworten soll; und drittens, wie wichtig dir die Frage überhaupt ist. Mit diesen Informationen kann OKCupid einschätzen, wie gut zwei Menschen zusammenpassen. Der Algorithmus rechnet und liefert ein Ergebnis. Ein praktisches Beispiel: Schauen wir uns an, wie wir für dich einen Treffer – sagen wir "B" – finden. Die Trefferquote mit B basiert auf Fragen, die ihr beide beantwortet habt. Nennen wir die Gruppe gemeinsamer Fragen "s". Als einfaches Beispiel verwenden wir ein kleines "s" bei nur 2 gleichen Fragen und suchen nach einer Trefferquote. Hier sind zwei Beispielfragen: Erstens: "Wie unordentlich bist du?" und die Antwortmöglichkeiten sind: sehr unordentlich, durchschnittlich, und sehr organisiert. Angenommen, du sagst: "Sehr organisiert", und möchtest, dass der andere "sehr organisiert" antwortet und die Frage ist dir sehr wichtig. Weil du ein Sauberkeitsfanatiker bist. Du bist sauber, der andere soll es auch sein, fertig. Sagen wir, B ist ein bisschen anders. Er antwortet selbst "sehr organisiert", aber "durchschnittlich" ist als Antwort von jemand anderem für ihn ok, und die Frage ist ihm nicht sehr wichtig. Schauen wir uns die 2. Frage aus unserem vorigen Beispiel an: "Stehst du gerne im Mittelpunkt?" Die Antworten lauten ja und nein. Du hast "nein" geantwortet, der andere soll auch "nein" sagen, und die Frage ist dir nicht sehr wichtig. B antwortet "ja", der andere soll "nein" sagen, weil er im Rampenlicht stehen will, und die Frage ist ihm einigermaßen wichtig. Rechnen wir das jetzt durch. Als ersten Schritt – weil wir dafür Computer verwenden – müssen wir Zahlenwerte mit Vorstellungen wie "einigermaßen wichtig" und "sehr wichtig" verbinden, weil Computer alles in Zahlen brauchen. Bei OKCupid haben wir uns wie folgt entschieden: 0 ist "unwichtig", 1 ist "ein wenig wichtig", "einigermaßen wichtig" ist 10, "sehr wichtig" ist 50, und "ein Muss" ist 250. Der Algorithmus macht dann zwei einfache Rechnungen. Die erste ist: Wie sehr bist du mit Bs Antwort zufrieden, das heißt, wie viele mögliche Punkte hat B auf deiner Skala erzielt? Du hast gesagt, dass Bs Antwort auf die erste Frage nach der Sauberkeit für dich sehr wichtig ist. Das sind 50 Punkte, und B hat richtig geantwortet. Die zweite Frage erreicht nur 1, weil du gesagt hast, es ist nicht sehr wichtig und B hat falsch geantwortet. B hat also 50 von 51 möglichen Punkten erzielt. Das bedeutet zu 98% zufriedenstellend. Das ist ganz gut. Die zweite Frage des Algorithmus betrifft Bs Zufriedenheit mit dir. B vergab 1 Punkt auf deine Antwort bezüglich der Sauberkeit und 10 auf deine zweite Antwort. Von diesen 11 Punkten – das sind 1 plus 10 – hast du 10 bekommen. Bei der 2. Frage waren beide mit der Antwort zufrieden. deine 10 Punkte von 11 liefern 91% Zufriedenheit bei B. Das ist nicht übel. Im letzten Schritt nehmen wir diese beiden Prozentsätze und basteln daraus eine Zahl für euch beide. Dazu multipliziert der Algorithmus eure Punkte, zieht die n-te Wurzel daraus, n ist die Anzahl der Fragen. Denn "s" – die Anzahl der Fragen – hier ist nur 2, und unsere Trefferquote ist die Quadratwurzel aus 98% mal 91%. Das ergibt 94%. Deine Trefferquote mit B liegt bei 94%. So drückt die Mathematik aus, wie glücklich ihr miteinander auf Grundlage unserer Informationen wärt. Warum multipliziert der Algorithmus, anstatt den Durchschnitt der beiden Ergebnisse insgesamt und die Quadratwurzel auszurechnen? Diese Formel nennt man den geometrischen Mittelwert. Damit kann man sehr gut Werte miteinander kombinieren, die eine große Spannweite haben und ganz verschiedene Eigenschaften darstellen. Anders gesagt, ist es für romantische Treffer perfekt. Es gibt eine große Spannweite und Unmengen verschiedener Datenpunkte, wie z. B. über Filme, Politik, Religion, über alles. Auch intuitiv ist das sinnvoll. Zwei Menschen mit gegenseitig 50% Zufriedenheit sollten besser zusammenpassen als zwei andere mit einer Zufriedenheit von 0 und 100, weil Zuneigung beiderseitig sein muss. Nach einer kleinen Korrektur für Fehlerspielräume, falls wir nur sehr wenige Fragen haben, wie hier in diesem Beispiel, können wir loslegen. Jedesmal, wenn OKCupid zwei Menschen zusammenführt, werden alle angesprochenen Schritte durchgegangen. Zuerst werden Daten über deine Antworten gesammelt, danach deine Wünsche und Vorlieben mit anderen Menschen auf einfache, mathematische Weise verglichen. Diese Fähigkeit, Phänomene der realen Welt in etwas umzuwandeln, das ein Mikrochip verstehen kann, ist meiner Meinung nach die wichtigste Fähigkeit, die jemand heutzutage haben kann. So wie du Sätze verwendest, um jemandem eine Geschichte zu erzählen, verwendet man Algorithmen, um einem Computer eine Geschichte zu erzählen. Wenn du die Sprache erlernen kannst, kannst du der Welt deine Geschichten erzählen. Dies wird dir hoffentlich dabei helfen.
Hello, my name is Christian Rudder, and I was one of the founders of OkCupid. It's now one of the biggest dating sites in the United States. Like most everyone at the site, I was a math major, As you may expect, we're known for the analytic approach we take to love. We call it our matching algorithm. Basically, OkCupid's matching algorithm helps us decide whether two people should go on a date. We built our entire business around it. Now, algorithm is a fancy word, and people like to drop it like it's this big thing. But really, an algorithm is just a systematic, step-by-step way to solve a problem. It doesn't have to be fancy at all. Here in this lesson, I'm going to explain how we arrived at our particular algorithm, so you can see how it's done. Now, why are algorithms even important? Why does this lesson even exist? Well, notice one very significant phrase I used above: they are a step-by-step way to solve a problem, and as you probably know, computers excel at step-by-step processes. A computer without an algorithm is basically an expensive paperweight. And since computers are such a pervasive part of everyday life, algorithms are everywhere. The math behind OkCupid's matching algorithm is surprisingly simple. It's just some addition, multiplication, a little bit of square roots. The tricky part in designing it was figuring out how to take something mysterious, human attraction, and break it into components that a computer can work with. The first thing we needed to match people up was data, something for the algorithm to work with. The best way to get data quickly from people is to just ask for it. So we decided that OkCupid should ask users questions, stuff like, "Do you want to have kids one day?" "How often do you brush your teeth?" "Do you like scary movies?" And big stuff like, "Do you believe in God?" Now, a lot of the questions are good for matching like with like, that is, when both people answer the same way. For example, two people who are both into scary movies are probably a better match than one person who is and one who isn't. But what about a question like, "Do you like to be the center of attention?" If both people in a relationship are saying yes to this, they're going to have massive problems. We realized this early on, and so we decided we needed a bit more data from each question. We had to ask people to specify not only their own answer, but the answer they wanted from someone else. That worked really well. But we needed one more dimension. Some questions tell you more about a person than others. For example, a question about politics, something like, "Which is worse: book burning or flag burning?" might reveal more about someone than their taste in movies. And it doesn't make sense to weigh all things equally, so we added one final data point. For everything that OkCupid asks you, you have a chance to tell us the role it plays in your life. And this ranges from irrelevant to mandatory. So now, for every question, we have three things for our algorithm: first, your answer; second, how you want someone else -- your potential match -- to answer; and third, how important the question is to you at all. With all this information, OkCupid can figure out how well two people will get along. The algorithm crunches the numbers and gives us a result. As a practical example, let's look at how we'd match you with another person. Let's call him "B." Your match percentage with B is based on questions you've both answered. Let's call that set of common questions "s." As a very simple example, we use a small set "s" with just two questions in common, and compute a match from that. Here are our two example questions. The first one, let's say, is, "How messy are you?" And the answer possibilities are: very messy, average and very organized. And let's say you answered "very organized," and you'd like someone else to answer "very organized," and the question is very important to you. Basically, you're a neat freak. You're neat, you want someone else to be neat, and that's it. And let's say B is a little bit different. He answered "very organized" for himself, but "average" is OK with him as an answer from someone else, and the question is only a little important to him. Let's look at the second question, from our previous example: "Do you like to be the center of attention?" The answers are "yes" and "no." You've answered "no," you want someone else to answer "no," and the question is only a little important to you. Now B, he's answered "yes." He wants someone else to answer "no," because he wants the spotlight on him, and the question is somewhat important to him. So, let's try to compute all of this. Our first step is, since we use computers to do this, we need to assign numerical values to ideas like "somewhat important" and "very important," because computers need everything in numbers. We at OkCupid decided on the following scale: "Irrelevant" is worth 0. "A little important" is worth 1. "Somewhat important" is worth 10. "Very important" is 50. And "absolutely mandatory" is 250. Next, the algorithm makes two simple calculations. The first is: How much did B's answers satisfy you? That is, how many possible points did B score on your scale? Well, you indicated that B's answer to the first question, about messiness, was very important to you. It's worth 50 points and B got that right. The second question is worth only 1, because you said it was only a little important. B got that wrong, so B's answers were 50 out of 51 possible points. That's 98% satisfactory. Pretty good. The second question the algorithm looks at is: How much did you satisfy B? Well, B placed 1 point on your answer to the messiness question and 10 on your answer to the second. Of those 11, that's 1 plus 10, you earned 10 -- you guys satisfied each other on the second question. So your answers were 10 out of 11 equals 91 percent satisfactory to B. That's not bad. The final step is to take these two match percentages and get one number for the both of you. To do this, the algorithm multiplies your scores, then takes the nth root, where "n" is the number of questions. Because s, which is the number of questions in this sample, is only 2, we have: match percentage equals the square root of 98 percent times 91 percent. That equals 94 percent. That 94 percent is your match percentage with B. It's a mathematical expression of how happy you'd be with each other, based on what we know. Now, why does the algorithm multiply, as opposed to, say, average the two match scores together, and do the square-root business? In general, this formula is called the geometric mean. It's a great way to combine values that have wide ranges and represent very different properties. In other words, it's perfect for romantic matching. You've got wide ranges and you've got tons of different data points, like I said, about movies, politics, religion -- everything. Intuitively, too, this makes sense. Two people satisfying each other 50 percent should be a better match than two others who satisfy 0 and 100, because affection needs to be mutual. After adding a little correction for margin of error, in the case where we have a small number of questions, like we do in this example, we're good to go. Any time OkCupid matches two people, it goes through the steps we just outlined. First it collects data about your answers, then it compares your choices and preferences to other people's in simple, mathematical ways. This, the ability to take real-world phenomena and make them something a microchip can understand, is, I think, the most important skill anyone can have these days. Like you use sentences to tell a story to a person, you use algorithms to tell a story to a computer. If you learn the language, you can go out and tell your stories. I hope this will help you do that.