And just like that... Explore the polycules.
Sex and the City is an iconic show that ran from 1998 to 2004. It was a cultural phenomenon and trailblazing show at the time, depicting social life, sex, and relationships through a lens rarely seen at that time.
But it had one fatal flaw: it was based on the assumption that each protagonist could only end up with one person.
I couldn't help but wonder... what if each person could be in an ethically and consenting relationship with more than one person at a time? What would the ideal polycule be? How would we even calculate that? These are the questions society needs to be asking! These are the real problems VCs should be investing in! Dare I say, if we put a man on the moon we can settle once and for all who Carrie actually should have ended up with.
- Clone this repo
- Run
yarn install
- Run
yarn start
The core assumption behind this whole algorithm is that compatible relationships can be broken down into a set of characteristics. So the first step was to figure out what those characteristics are. I did a quick Google search for "relationship characteristics" and clicked on the very first link I got at the time, which opened an article on "The 14 Most Important Characteristics of Healthy Relationships". I took those 14 characteristics as fact and used them as the entire basis of this algorithm.
But wait, you ask, that's all the research I did? No thorough literature review? No citations of academic papers to back up this choice? You're damn right I did none of that. The goal of this project was to come up with an algorithm to calculate polycule compatibility. Theoretically that means the exact relationship traits are replaceable as long as the math is sound. If you don't agree with my choice of successful relationship traits, just fork the repo and choose your own! If that upsets you, remind yourself you are looking at a repo about "Sex and the City" polycule calculations. Scientific rigor was not exactly top of mind and if you made it this far into the readme then your decision-making skills are already questionable enough and you and I are more alike than you think.
So let's begin!
Let's assume we have
Where
Now let's assume there are
Let
But this is a naive equation because it just assumes that a polycule's score on a trait is just the average of each partner's individual score. All this really tells us is the average individual performance on a trait, not the polycule's performance on this trait. We need some way to quantify how a partner's performance on a trait can affect their partners. To do this, we'll add the concept of "importance" of a trait.
Each individual will now have both a performance score for a given trait and a measure of how important it is to them that their partner exhibit this trait. The argument here is that if a trait is very important to someone, being less than perfect on that trait should have a negative effect on the polycule's score. And vice versa, if a trait is very unimportant to someone, it doesn't matter how bad others are at that trait, it won't really affect the polycule's health.
Let
Personally, if asked, I don't think that we conceptualize "importance" on a linear scale. I think it's closer to a bell curve. Most people will see the importance of a trait somewhere between "important" or "unimportant," but the extremes ("extremely important" or "extremely unimportant") are a lot less common. So we need some way to convert the importance score to a percentile. What we really want to know is, given an importance value
Ideally, we'd have some representative sample of the general population where everybody has been asked to score how important each trait is to them. From there, we can get an empirical distribution of importance ratings. Since I haven't done any such survey, I made up a normal distribution that had a curve I liked and made me go "yeah, that's it." So let's assume that
So now that we have a non-linear representation of "importance," our new equation is:
Each individual trait score is now exponentiated by 2 times the importance percentile. The exponentiation is a convenient way to reduce a score if the importance percentile is high, but increase a score if the importance percentile is low. So now, being bad at an important trait will lower the score more, but being bad at an unimportant trait will not penalize the score nearly as much. The nested loop lets us capture all pairwise interactions in the
To simplify, we will define
So the
Up until now the scoring equation has been purely punitive. Any individual trait score that is less than perfect will invariably reduce the polycule's overall score. The only way to get a perfect 100% compatibility is to be perfect at every trait (or for everyone to find each trait 0% important). This isn't realistic though. I'd like to think that a relationship isn't just a series of dealbreakers and if "Sex and the City" taught me anything it's that you don't need to be perfect to find happiness.
There has to be some way to boost your score if you are good at a trait that is important to your partner. For example, if honesty is really important to me and I have a very honest partner, that should give our compatibility a boost! So let's introduce a "You-did-good" reward function. What this function should do is that if a trait is important enough, we should figure out how far away a pairwise trait score was from perfect, and add back some of that score (scaled by some factor).
So I am going for a threshold-based reward function, denoted
So the reward function is only added if a trait's importance is greater than 0.5 (i.e. it is more than "meh" importance).
After a lot of tinkering and trial and error with plots, I landed on:
Why? You guessed it. I liked the curve. It made me go "ooooohhh."
The reasoning here is that being "rewarded" should be difficult, because you have to be really good at something that your partner really cares about. We shouldn't just be rewarding mediocre behavior on barely important traits! So that's why we cube
So our new equation is:
We're almost there! Until now, we've represented a polycule's compatibility as the average of all pairwise compatibilities. This is a reasonable start, but it implies that a polycule is just a sum of 2-person relationships, which is inaccurate. Anybody who's watched Steven Universe understands that a relationship is not just the sum of its parts, but is also holistically it's own distinct entity. Therefore, we need some way to quantify the
Let's imagine a
Rather than relying on quantum physics to measure stability, I decided to make my life easier and turn to basic statistics and use a mean squared error (MSE). Let's assume that the MSE of a
Lastly, we still want to consider the average importance of this trait. For example, let's say we have high MSE in affectionate scores, but if the polycule on average doesn't give much importance to being affectionate then this variance doesn't matter as much. So we will modulate the MSE of a trait by how important that trait is.
Let
The final Polycule Compatibility Score equation is: