Tag Archives: modeling

Where Black Mirror’s “Hang the DJ” Goes Wrong

Charlie Brooker’s Black Mirror offers an incisive perspective on how the human struggle adapts as technology progresses. The episode, “Hang the DJ,” (HtDJ) is a story about what happens when an algorithm can predict love.

Wait a second … that’s what Nanaya does!

In my last post, I described how the algorithm in HtDJ works. This time, I’ll describe why the HtDJ doesn’t work in terms of the computer science and human psychology, as well as how Nanaya compares to HtDJ.

What HtDJ and its Algorithm Get Wrong

While much of the HtDJ’s app algorithm is feasible to code there’s a lot about it that could be done better, or simply would not work in a reasonable way. For example, the bots in the simulation are exposed to a limited set of interactions.

Real Life is More Complex

Consider that we never see Frank (Joe Cole) go to work, Amy (Georgina Campbell) deal with her parents, Frank deal with Amy’s parents – and so on. We also never see Amy and Frank experience non-monogamy. These sorts of interactions happen in real life and indicate a lot about who people are both in and out of relationships.

To generalize, the characters never dealt with the concept of scarcity, except, notably, the scarcity of time. In the real world one can imagine a scenario if Frank were to come back from work disappointed by not getting a raise. It would inject a real-life interaction into the relationship. Frank is providing less money, a planned vacation may not be taken, and resulting with Amy to also be disappointed and to perhaps harbor resentment for Frank’s middling ambition.

A weak way to resolve this gap without significantly burdening the simulation would be “fabricating” emotional memories based on what the dating app observes from the user in their real life. This could be done by appending to a user’s emotional memory during a non-interacting period (like the bot’s simulated sleep).

Even simpler, and possibly more impactful, is taking time off from relationships. In HtDJ, the user’s bot is paired with another bot immediately after their previous relationship ends. In reality, people learn a lot during durations of singledom as they reflect on who they are and what they want from their next relationship. So, if we assume that the app can accurately evolve people such that they learn from experiences, it really, really needs to model being single.

To add these types of interactions in the simulation would be to fundamentally assume the way in which bot individuality evolves is representative of how a real-life user would evolve.

Modeling Real-Life Dynamics is Tough

There are several reasons why this is essentially impossible. One reason that I’ve already described before on the blog is chaos. Or maybe Ian Malcolm can summarize it:


Specifically, a computer simulation describing evolving human behavior is almost guaranteed to diverge dramatically from real-life behavior to the point that artificial patterns of behaviors will emerge leading to significant error.

In other words, if bots in the simulation evolve identically to people in real life – the simulation could still be completely off-base just because someone’s individuality was measured within some standard measurement error. For instance, Amy was scored to be an extrovert with a score of 50±2. If her true, real-life extroversion were actually 52 divergences can be expected. Moreover, because how you define simulated individuality will vary based on convention, there is no fundamentally correct mapping to real-life individuality – the predictive power of such a time-variable approach is significantly limited even if the core nature of the simulation and real life are identical.

As it is unlikely the simulation can accurately describe individuality, interactions, and memory completely, synthetic patterns of interactions and emotions will be created. These synthetic emotions would then be used in the rebellion scoring routine in a manner that would simply not be accurate.

So, if a simulation can’t be expected to model real-life evolution of human behaviors, what’s the value of a system simulating dynamic behavior? I believe that the dynamic modeling is a waste given the vast computation required. In general, it’s highly unlikely that any of HtDJ’s simulations would have rendered graphics and simulate the environment because you would have to write code and pay for processing time that isn’t required to arrive at the solution.

HtDJ’s Similarities to the Nanaya Algorithm

At the core of both algorithms is the notion of matching individuals, evolving their relationships in some manner, and comparing scores of romantic options to determine an optimal solution. No other dating apps do this: only Nanaya in real life and HtDJ’s system in fiction.

Simulated Partners

HtDJ featured a lot of nameless partners that Amy and Frank had. Were these based on real people? Were they made up by the algorithm? I think it’s pretty safe to assume HtDJ picks partners based on who is on the app in your area. However, it’s unclear if the partners it picks are actually those a user might date.

For instance, Frank’s first partner after Amy was not only uninterested in Frank but also didn’t seem to share any compatibility whatsoever. In real life, it’s hard to imagine there would even be a first date between them.

On the other hand, the Nanaya algorithm generates fake partners that are those who you have enough in common with such that you might end up dating but later find an incompatibility with. This approach is not just more realistic but also reduces wasteful computation.

Ultimately the core difference is precisely that HtDJ’s system’s bots exist and evolve in scaled time. If you accept the reasons discussed above, then dynamic simulation of bot individuality is not computational efficient. You will spend a lot of effort simulating the dynamics of relationships in a way that has no bearing on reality. So why bother?

Simulation Decisions

A scoring solution based on static variables is Nanaya’s alternative method. In other words, the Nanaya algorithm uses simple equations to estimate value of a relationship based on the initial conditions of your identity. There would be no point having bots grow and learn in the simulation because it’s just not accurate enough. As soon as it’s not worth it for bots to learn – there’s no point in simulating a timeline!

Now instead of 1,000 timelines, you simulate 5,000, or even 10,000, possible partners in addition to the matched partner. Without timelines and dynamically evolving bots, the “rebellions” in HtDJ are unnecessary and can be simplified to comparing scores from a utility function.

This leads to another key difference. HtDJ’s system only cares about the compatibility with the match for a match score. Nanaya does this but it does two other equally important things. First, it estimates your likelihood of meeting other people you would be compatible with if you choose to not date the prospective or existing partner. Second, it also considers how willing you actually are to settle into a relationship. For instance, a user might have a very compatible match lined up, but what’s does it matter if the user is also content being single?

In summary, Nanaya uses a far simpler way to estimate relationship satisfaction while at the same time does more to account for real-life situations.


“Should I Dump My Girlfriend? Will I Find Another?”

Well let’s not get too hasty.

Earlier this week, I posted the Nanaya white paper to ArXiv: “Should I Dump My Girlfriend? Will I Find Another?” Or: An Algorithm for the Forecasting of Romantic Options. The title is a bit melodramatic but it’s a reference to Peter Backus’s “Why I Don’t Have a Girlfriend.” Apologies to everyone, especially Dr. Backus.

So this paper summarizes how the Nanaya algorithm works. I genuinely wonder who will have actually read it. Theory papers are hard enough to get through on their own and then harder yet when it’s an interdisciplinary mush. So we’ll go over some of the key points here.

The first major issue is uniqueness. Did we do anything academically worthy? Well, a lot of people have worked on the Secretary Problem (to be covered in a future post), but no one has really tailored it for a situation like romance. There are simplifications that do little justice to the complexity and information available to people – but those aren’t useful. Let’s just call it overzealous journalism…

We also do something new: comparing a specific relationship to being single and the chance of any other relationship. This is options analysis and rather new to the problem.

The Nanaya process.
The Nanaya process.

The rest is explaining what’s going on in the algorithm. Let’s check out the first figure:

So let’s break it down by each step:

Assessment of Inputs

When the Nanaya Beta is up (pending funding, be sure to call your local, friendly Venture Capital fund and request them to fund Nanaya) we’ll be asking a bunch of questions to understand your life circumstances:

  • What is your personality and social and romantic history. This gives us an idea of how likely you’ll be successful in finding a match, attracting a match, and how happy you are when you don’t have a partner in your life. We also need to know how long you’ve been in the city and job you’re in as that has a huge impact on how many people you’ll be meeting. You can check out this blog post that goes over this detail.
  • What is the ideal This is a mix of personality and specific values that are shared.
  • If you’re with someone, how do you feel about them.
  • The groups you interact with, like at work, geographically, and in socializing.

Determining Match Probabilities

With all of that data we can use our database and others available to us to figure out what the chance is of finding a match in any given encounter, depending on the group.

These numbers are typically low. Something like 1-in-10,000 is not unreasonable. This is where statistics comes in to play and you have something like the birthday paradox to offset those low odds.

Sociological Modeling

This is where we mix the match probabilities with your social behavior to figure out what are the chances of actually meeting someone. This is a bit of sociology and a bit of statistics to solve a problem no one’s really touched before, at least in this context (if I’m wrong, let us know). The sociology is based on personality, group types, and the results of some of our prototype experiments. The probability is based on binomial distributions and a variation of the Urn Problem. This is how we describe our social interactions…with urns!

The Nanaya implementation of the Urn problem
The Nanaya implementation of the Urn problem

We admit we make some simplifications in the paper, namely use of binomial probability distributions and assumptions that populations are very large. For almost everyone, these are pretty good assumptions but not for people in small populations. This gets into a lot of theoretical combinatorics which is well understood but not yet implemented.

Utility Function Valuation

This is the ugly philosophically ugly part where we literally put values to things that ordinarily don’t have numbers associated with them: like compatibility and happiness.

Using personality test results for who you are, who you want, and who your partner is we can estimate how happy you’ll be in any given relationship. We can also use your personality and romantic history to gauge how happy you’ll be in time as you’re single.

To simulate a random match you meet through the course of your life, we run a Monte Carlo simulation based on the groups you interact with. Some groups will have their own types of traits that lead to specific archetypes or segments (in demographic-speak) – we want to respect what’s observed in reality so we use these archetypes in seeding the randomness of the Monte Carlo.

Reporting the Results

With all of the above done, all that’s left is showing the numbers in a way that’s easy to digest!

If you sign up and take our personality tests, we’ll be inviting you to join our Beta program when it’s ready! So be sure to take your personality test and start today!


Does Online Dating Actually Boost Your Odds?

This is a bit of a no-brainer: online dating increases your exposure to more people than you ordinarily would run into each day. Sometimes that’s not so good:

But let’s face it, it’s not always easy to meet people you want to meet and the one might be out there. There’s pretty minimal investment in online dating, for better or worse.  If you use a site like eHarmony or OkCupid, they do a bit of work in figuring out your personality and finding matches that you’d likely be compatible with. That makes things even easier.

But is it worth that minimal investment? The costs of premium services, frustration of having your messages ignored, objectifying remarks, and simply the wherewithal needed to maintain yet another online account?

If you have thick enough skin, yes. It’s all in the math.

We can use a few portions of the Nanaya’s algorithm to show the impact. At a high level, there are two major factors that govern whether or not you will run into a match: how you interact within groups you belong and the chance that, upon any given encounter within a group, that a person will be your type.

I’ve used values from a volunteer who lives a rather normal, post-college life in the same city she was raised. She isn’t too picky but because there isn’t too much variation in social habits, the odds of someone new popping up aren’t distinctly high. In fact, the ideal environment for meeting compatible matches, work, is also one of the worst because of low turnover rate. She isn’t very picky but just enough that people she’ll run into out on the town will probably not be her type but a group of close friends has a different distribution of personalities than the city itself. Distant friends, family, and strangers met traveling are the smallest contribution.

Let’s look at her odds without online dating:

Volunteer's odds of finding a match without online dating broken down by group.
Volunteer’s odds of finding a match without online dating broken down by group.

The relative probability is shown for each group normalized by the “all groups” probability for that given point in time. You can compare this to the “stacked line” plot on the main page of Nanaya.

So what happens if she starts to go on a few online dates from people online starting in a year at a frequency of about one date every two months?

Volunteer's odds of finding a match with and without online dating.
Volunteer’s odds of finding a match with and without online dating.

We can see the group breakdown for the real effect of online dating. It’s pretty dramatic, especially considering how many more people she meets elsewhere!

Volunteer's odds of finding a match with online dating broken down by group.
Volunteer’s odds of finding a match with online dating broken down by group.

Some people might notice that it’s seems incorrect to separate potential matches from the local area from other, similarly local places (i.e. work and online). There’s undoubtedly validity to that argument but biased sampling, i.e. real human interactions, indicate otherwise. There are different personalities demographic, especially considering the size of the local population and the way data is aggregated. We also assume that there exists a sufficient sample of compatible men online for the volunteer to date, but most metropolitan areas are well populated when it comes to online dating and most sites do a good job of filtering. It’s that filtering that really helps the “signal to noise” problem in finding compatible partners.

Fortunately for my volunteer dating, let alone online dating, isn’t an issue. She’s actually happy in a relationship! After running the prototype, Nanaya predicted she should stick with it. A decision she had already confidently made. Good news for the volunteer and good news for continuing validation!

But the impact of online dating isn’t exclusive to that volunteer. All validation studies have shown it to be a rather significant part of improving romantic outcomes, ceteris paribus, anyway.

If you are interested in increasing your odds in finding a match, I recommend having an online dating account. Even better if the site is well trafficked and has personality testing. Log in now and again to search for new people and check on your inbox, but don’t take it too seriously. Why? That gets into ceteris paribus and that’s the subject of a later post.

Chaotic Love: What math can tell us about how relationships evolve

I’m very proud to say that Nanaya solves a problem that hasn’t been solved before: determining the value in time of relationships and the option of possible relationships. The Nanaya algorithm has to be pretty complicated to do all of that – a machine of gears, pulleys, and switches that work together to provide a result. The machine has many parts of which are some have been around for awhile.

For instance, the problem of determining relationship quality and stability has been worked on. My old textbook, Nonlinear Dynamics and Chaos by Steven Strogatz, works out an example. This isn’t exactly how Nanaya works but we can take this as a “simple” example.

To evolve a relationship in time, we need to know a few things:

  1. Who are the people before their relationship begins? That is to say, what are their personalities and life circumstance before the first kiss.
  2. How do their personalities interact?

Because this is math we need these to be quantified. We can do that with personality testing and asking a few other questions.

Now what’s next is to set up a system of differential equations. Specifically, there is an equation for each partner that shows how much their affection changes in time based on who they and their partner are. We can consider the simple example of “Romeo” and “Juliet” from Strogatz.

System of differential equations for our lovers.
System of differential equations for our lovers.

Oh dear. So what do these equations mean?

So R(t) and J(t) are functions of love/hate in time. Let’s use dR/dt as an example, though you’ll notice both equations are very similar. R(t) is Romeo’s affection toward Juliet. When R(t) is positive, he is happy with Juliet; when it’s negative, he’s not. dR/dt is simply how much his affection is changing at any specific point in time based on the shared emotions of the couple.

At time zero we have R(t=0), which is Romeo’s interest in Juliet before the relationship.  J(t) and J(t=0) are the same values for Juliet. The values a and b are factors that multiple the feelings of the couple for a specific person. The larger a is, the more Romeo is happy that he is in love. The larger b is, the more Romeo is happy that Juliet loves him.

Well that’s a lot of math. Of course any model like this is a huge oversimplification of reality. Here we look at two dimensions: how Romeo and Juliet feel about each other. These can be broken into many, many other dimensions based on personality and other factors. The oversimplification is welcome as adding more dimensions allows for very complex behaviors that aren’t very predictable. Essentially, the system becomes chaotic as described by chaos theory.

As complicated as it appears it’s very easy to see what happens for various personalities and initial conditions!

So we can consider a few personality types based on a & b:

  • Excitable lover: where a > 0 and b > 0. For the excitable lover, any positive emotions from either partner just make the person happier and happier.
  • Neurotic lover: where a < 0 and b > 0. For the cautious lover, self-doubt causes affections to diminish but love from a partner can over come it.
  • Narcissistic lover: where a > 0 and b < 0. For the narcissistic lover, personal feelings are more important than how a partner feels.
  • Hater: where a and b < 0. For the hater, any love is toxic. Even if they have early affection, that disappears. The more they’re loved the more they’ll run away.
  • There are special cases where either a and/or b = 0. We don’t like haters around here.

That gives us ten different combinations of relationship types, ignoring those special cases. Even for each pair of relationship types there are several different outcomes. For instance, how identical are their personalities and how attracted are they at the beginning of the relationship? Let’s see a few different test cases.

These are parametric plots. In all these cases the arrow indicates going forward in time. Positive values indicate affection and negative are annoyance or dislike (i.e. top right is mutual affection, bottom right is Romeo loves Juliet but Juliet does not love Romeo, bottom left is mutual dislike). Units are arbitrary!

 Two Identical Excitable Lovers With Mutual Attraction

Figure 1
a = 5; b = 5; c = 5; d = 5; R(0)=0.1; J(0)=0.1

This is the predictable outcome when two excitable lovers, attracted to each other, fall in love. Romeo and Juliet are attracted and that initial attraction just builds in time to create a positive feedback loop of mutual admiration. They go off into a bright, love-filled future.

Two Excitable Lovers With Juliet Not Initially Attracted

Figure 2
a = 3; b = 1; c = 1; d = 1; R(0)=0.1; J(0)= -0.25

 Without being initially attracted, Juliet simply isn’t interested even though Romeo is. Romeo has a persuasive personality, which causes her to change her feelings a little bit but she remains unconvinced. As time goes on, the relationship is simply unsustainable and the two part ways.

Now what happens if Romeo is just a little more persistent? We can tweak the a from 3.0 to 3.106 to find out:

Figure 3
a = 3.106; b = 1; c = 1; d = 1; R(0)=0.1; J(0)= -0.25

In this case, Romeo can cajole Juliet just enough for her to overcome her initial ambivalence or lack of attraction to fall in love. In the near future, it’ll be a one-sided relationship but it will ultimately become more equal in love over time.

A Neurotic and Excitable Lover

Figure 4
a = -2; b = 1; c = 1; d = 1; R(0)=0; J(0)= 0.1

Here we have a neurotic Romeo. A little bit of attraction at the start from Juliet enables a relationship to form but it ends up a bit lopsided. As time goes on, it’s clear to see Juliet does love Romeo “more.” There’s nothing wrong with Juliet per se, just that Romeo needs to learn to love himself apparently.

An Excitable and Narcissistic Lover

Figure 5
a = 1; b = -10; c = 10; d = 1; R(0)=0 ; J(0)= 0.1



A recipe for disaster, it’s an unstable relationship! As soon as the narcissist Romeo feels too loved he wants his freedom but as soon as Juliet pulls away he wants attention. Because Juliet will keep loving Romeo so long as he’s happy, the relationship just oscillates between love and hate. It’s unclear what happens in the end but it’s truly something to avoid unless you really like drama. Maybe someone could write a play about it?

So there you have it, we can try to predict the long-term behavior of relationships with mathematical modeling. Reality is a lot more complicated as human relationships span more dimensions than mutual affection. With those extra dimensions comes the chaos that makes predictions all but impossible. It’s even harder when there’s no truly objective means of assessing personality and integrating life circumstances with personality as a means of determining initial conditions.

But difficulty be damned. At Nanaya, we’ve worked on isolating those most important parameters and determining relative long-term behaviors. We’ve made unpredictable, computationally intensive problems tractable and realistic. With the help of volunteers, we’ve validated our prototype outcomes. As time goes on, we look forward to more data as a means of further validating and improving our theory.