Posts

  • How An Audio Play About a Time Traveling Pony Turned Me Into a Fanboy

    Life is really unpredictable.

    You know the cliche interview question,

    “Where do you see yourself in five years?”

    There’s the answer you’re supposed to give: “At the same company, but higher up the ladder.” I’ve always wondered about the people who actually answer that both honestly and confidently. How can they be so sure of where their life will lead? People like that actually exist?

    If you has asked me that five years ago, I’d have no idea what to say, but I certainly wouldn’t have told you I’d be writing a post about a MLP x Doctor Who fan series.

    ***

    The Short MLP Primer

    My Little Pony: Friendship is Magic is a cartoon about pastel colored horses living lives with other pastel colored horses.

    The main horse (okay, pony) is Twilight Sparkle, a unicorn prodigy. She’s incredibly smart and hard working, but she’s also a bit socially inept, and is prone to freaking out over small details.

    It’s surprisingly good. Although it takes a while to warm up to it, once you like the characters the show just clicks and becomes a joy to watch. Friendship is Magic starts with Twilight saving the world from eternal darkness, then shifts to slice of life. On rare occasions, it shifts back to adventure, where the main cast have to fight monsters that escaped Tartarus, break up communistic cults, and save kingdoms from totalitarian dictators.

    Yes, really. All of that is canon.

    As for the fandom, the MLP fandom is one of the craziest and most prolific fandoms in the world, and I proudly count myself as a member.

    The Short Doctor Who Primer

    So. I actually haven’t watched any Doctor Who. Everything I know about the show is from Internet osmosis. I’ll say what I know, and apologize in advance for any Doctor Who misrepresentation. (So to any Whovians reading this: please don’t kill me.)

    Doctor Who is a long running show by the BBC. I do mean long. The first episode aired over 50 years ago.

    The eponymous Doctor is a Time Lord who time travels in the TARDIS, which takes the appearance of a London police box. Although he looks human, he’s somewhere around 1000 years old. Whenever he dies, he regenerates into a new form and personality, which keeps the show fresh. (That’s the in-universe explanation. In reality, it’s a way to change the actor.) Together with a companion (a human who’s in on the Doctor’s secret), he travels through time and space, fighting monsters like the Daleks or the Weeping Angels. Or, he resolves the local trouble he sees in this part of the multiverse. Most likely, he’s doing both at the same time, all while being either a little too insane or not insane enough.

    So….Why Are There MLP x Doctor Who Crossovers?

    Some people noticed there was a recurring background pony with hair very similar to David Tennant’s, one of the Doctor’s actors. He also had a cutie mark of an hourglass, meaning his special talent was related to time.

    Comparison of the Doctors

    Left: the pony. Right: the human. Honestly, not a slam dunk case.

    When you combine those two details with the craziness of the MLP fandom, there’s only one reasonable outcome. Fans quickly christened him “Doctor Whooves” and to this day he’s one of the most popular fan characters.

    Companions of Doctor Whooves

    The companions from just the audio plays. Left to right: Tick Tock, Twilight, Trixie, Roseluck, Derpy, Doctor Whooves. Include fanfic and you might as well add the whole cast. (By Lilla Dessert.)

    The Adventure Begins

    Among the sea of fan content was the fanfic “Number 12”, by SqueakAnon. (The name is accurate. Squeak’s gender and real name are both unknown.)

    Squeak’s take was that Doctor Whooves was the 12th Doctor (the show was on the 11th at the moment.) The story starts with the TARDIS crashing into Twilight’s home, and ends with Twilight becoming the Doctor’s companion. It was well received, and that was that.

    A while later, Squeak decided to take it one step further. He or she contacted other members of the fandom, and formed Pony In A Box Productions. Their mission: to create a full-fledged radio play. Their first episode was an adaptation of “Number 12”, and ever since they’ve been releasing new episodes under the banner Doctor Whooves Adventures.

    And now we come to me. Around two years ago, I decided to listen to a few episodes. At first, it was just entertaining, but just like with MLP, at some point I realized Pony in a Box had stolen my heart, locked it away and threw away the key, and I didn’t even care. I love this series so, so much. I actually find it difficult to find things I don’t like about it. Doctor Whooves Adventures is in my favorite works of all time list, and it’s singlehandedly convinced me to watch Doctor Who, as soon as I find time for the inevitable binge.

    Why Should You Watch This Show?

    It’s funny when it wants to be, but isn’t afraid to be sad. The characters are not only well written but well acted. It mixes the two canons well: the overarching themes of death and loss from Doctor Who are tempered by themes of optimism and friendship from My Little Pony. Yet despite taking elements from both, you don’t need to know either My Little Pony or Doctor Who to enjoy this series. Everything is played straight and with few fandom in-jokes, and the cast carries the series on its own.

    Below, I’m going to repeat the above, but in many, many more words. Let’s get to it!

    Production Values

    Normally, you don’t expect fan creations to go through much production, which makes the effort put into Doctor Whooves Adventures all the more surprising. Pony In A Box holds themselves to high standards, and it shows. First, the writing staff (led by Squeak) prepares a script. Then, the voice actors record their lines. Once done, the sound team comes in, adding background music and sound effects. (As someone who has done very minor movie editing, this is both more important and more time consuming than it sounds.) At the same time, the art team creates promotional pictures. Finally, they publish to Youtube and iTunes. Every episode is a huge labor of love, and it shows in the end product. Here’s an excerpt showing this off. It’s from “Bells of Fate”, my favorite episode. In this part, a librarian is recounting the founding of the Green Isles.

    Unfortunately, all that production means each episode takes a long time to finish. I’ve been waiting for the conclusion to “Bells of Fate” for over a year. Still, it’s coming out soon! Meaning, they targeted August of this year and it’s the end of September…but it is happening and I can’t begrudge the team too much. I know how long these things can take.

    The Writing

    The writing and voice acting for this series is top notch. The strength of the vocal cast is a huge asset here, since the way they say the lines often conveys more than the words themselves. Because the writers can trust the voice actors, every line can focus on driving the plot forward without sacrificing characterization. Addtionally, since the characters are well defined, the plots can grow organically from the seeds the writers plant, letting them avoid the “hand of god” problem. (That’s my term for when writers need to add out-of-character moments to railroad the plot.)

    The show also makes a point of having strong female characters and a gender balanced cast. (This is true of most MLP fanwork. When a fandom grows in open defiance of gender stereotypes, people pay a lot of attention to avoiding them. It’s a beautiful part of the community.) Twilight’s a fantastic companion; as one of the smartest ponies in MLP canon, she might be the only character that can keep up with the Doctor. She solves problems and gets herself out of trouble almost as often as the Doctor does, and although the Doctor knows more about the universe than she ever will, Twilight is the one who knows the most about the pony-filled world the Doctor landed in. They get a great teacher-student relationship going, and it’s just fun to see them play off each other.

    There’s plenty of dry, deadpan situational humor as well. From the start of “Wrong Way Backwards”, where Twilight and the Doctor are shopping:

    And although light humor is the standard tone of the show, one of the running themes is that people (or ponies, in this case) are haunted by tragedies from their past. From “Shadows of the Lunar Republic”, the account of a lunar pony:

    However, after lots of struggle, everyone gets past their tragedy and self-loathing, moving on to better lives. That’s my favorite part of the writing. Everyone earns their happy ending, and it all ends well. Sure, maybe that isn’t realistic, but who says it has to be?

    Parting Remarks

    If you do decided to listen to the series, you can do so here. I recommend listening in episode order. Should you get bored, each story arc is only 2-3 episodes long, and there’s little continuity between them, so you’re free to jump to the better episodes. Here’s my short list, with the standard your mileage may vary caveat.

    • Number 12 Part 1 + 2. You absolutely need to start here, no questions. It’s not the best episode, but this introduces all the characterization, so it’s unskippable.
    • Bells of Fate. My favorite episode. Great mythology influences, and the two plots tie together elegantly. (Fun fact: this episode actually got me into Irish music.)
    • Rhapsody in Blue Box. Tugs at the heartstrings more than any other. May be better after listening to the short Cell Mates, but the story is getting told out of order anyways. You’ll be as confused as the rest of us whether you’ve seen the episodes in order or not.
    • Wrong Way Backwards Parts 1 + 2 + 3, then 1 + 2 + 3 to fill the gaps. You’ll see what I mean. Timey wimey, wibbly wobbly, and all around fun. This episode’s construction is the most impressive, but it’s also the longest by far, especially if you listen to both sides.

    The remaining episodes (Shadows of the Lunar Republic, Chords of Chaos, Pony of the Opera) are ranked similarly. They’re fun, but not as strong as the rest.

    ***

    It’s so strange to realize that five years ago, I was still in high school. So much has changed since then. I’d like to think I got a bit smarter, but odds are I’m still just as dumb and don’t know it yet. I’ll look forward to making another rant in a few years about why I was an idiot.

    In five more years from now? Who knows? Maybe my love for this series will fade, but it’s hard to see that happening. Maybe Doctor Whooves Adventures will die a slow death, as the creators lose interest, but I hope that never comes to pass. The only thing I’m certain about is that I’ll never be certain about how my tastes will shift. The best I can do is to stay open to change, and to keep reaching.

    Until next time. In the words of the good Doctor himself,

    Series Logo

    “Onwards and upwards!”

    Comments
  • The Other Two Envelope Problem

    The two envelope problem is a famous problem from decision theory, at least famous enough to have its own Wikipedia page. It’s an interesting problem, but this post is about its less well known variation.

    Here is the formulation.

    There are two envelopes, one with \(A\) and one with \(B\) dollars, \(A \neq B\). \(A\) and \(B\) are unknown positive integers. You are randomly given an envelope, can look inside, then must choose whether to switch envelopes or not.

    Does there exists a switching strategy which ends with the larger envelope more than half the time?

    At first glance, the answer should be no. Although we know the contents of one envelope, we have no information on how much the other envelope might have. When the other envelope is a black box, how can we make a meaningful decision?

    As it turns out, such a strategy does exist, and the small amount of information we have (the amount in the current envelope) is enough to improve our standing, even when the alternative has unknown value.

    The Power of Randomness

    The trick is to make the switching decision randomly, in a way that biases outcomes to end with the larger envelope. The strategy is as follows:

    • Inspect amount \(X\) inside the envelope.
    • Flip a fair coin until it lands tails.
    • If there were at least \(X\) flips, switch envelopes. Otherwise, do not switch.

    For analysis, assume without loss of generality that \(A < B\). There are two ways to end with envelope \(B\). Either start with \(A\) and switch, or start with \(B\) and do not switch. The first case happens with probability

    \[P[\text{started A, switched}] = \frac{1}{2}\left(\frac{1}{2^{A}}\right)\]

    The second happens with probability

    \[P[\text{started B, did not switch}] = \frac{1}{2}\left(1 - \frac{1}{2^{B}}\right)\]

    So, the chance to end with \(B\) is

    \[\frac{1}{2} + \frac{1}{2^{A+1}} - \frac{1}{2^{B+1}}\]

    which is indeed larger than \(1/2\) for \(A < B\). \(\blacksquare\)

    Extending to the Reals

    This coin flip strategy works when \(A\) and \(B\) are integers, but fails when \(A,B\) are arbitrary reals. The problem is that the number of flips comes from a discrete distribution, so it does not have the granularity to distinguish between values like \(A = 2.3, B = 2.4\).

    So, how is this strategy extendable? The way the current strategy works is by creating a decision boundary based on the amount in the seen envelope. The boundary is then applied to the geometric distribution with parameter \(p=1/2\).

    Geometric pmf with decision boundary

    Decision boundaries when \(A = 2, B = 4\). The switching strategy gets an advantage when the sampled \(Y\) lies between the two boundaries.

    To handle arbitrary reals, we should use a continuous probability distribution instead. Nothing in the previous logic relies on the distribution being discrete, so we can simply drop in a distribution of our choice. The only requirement we need is a strictly positive probability density function over \((-\infty, \infty)\) (we’ll explain why we need this later.) The standard normal distribution \(N(0, 1)\) will do fine.

    The modified strategy is

    • Inspect amount \(X\) inside the envelope.
    • Sample \(Y\) from \(N(0,1)\).
    • If \(Y \ge X\). switch. Otherwise, do not switch.

    Normal pdf with decision boundary

    Decision boundaries when \(A=0.5, B=1.5\). Again, the switching strategy gets an advantage when \(Y\) falls between \(A\) and \(B\).

    The proof is also similar. For \(A < B\), \(P(Y \ge A) > P(Y \ge B)\). This is why the p.d.f. needs to be positive everywhere. If the p.d.f. is zero over some interval \([a,b]\), it is possible that both \(A, B \in [a,b]\), which gives \(P(Y \ge A) = P(Y \ge B)\). The chance of ending with the larger envelope is

    \[\frac{1}{2}P(Y \ge A) + \frac{1}{2}\left(1 - P(Y \ge B)\right) = \frac{1}{2} + \frac{1}{2}\left(P(Y \ge A) - P(Y \ge B)\right) > \frac{1}{2}\]

    and this strategy generalizes to real valued envelopes. \(\blacksquare\)

    Extending to Multiple Envelopes

    At this point, it’s worth considering whether we can take any lessons from this problem. If we substitute “given an envelope” with “given an action”, and “dollars” with “utility”, this result suggests that even with no information on alternative choices, we could use a random action to improve our current standing. In real life, we often have very little information on how different actions will play out, so this power to bias towards improvement is appealing. However, in real life there are usually much more than two possible actions, so we should first consider whether the two envelope framework is even valid.

    When there are \(n\) envelopes instead of \(2\) envelopes, we can no longer aim for only the best envelope. The switch could slightly help us, slightly hurt us, especially help us, or especially hurt us. Because of this, we need to modify the criteria of a good strategy.

    There are \(n\) envelopes, which give utilities \(A_1 < A_2 < A_3 < \cdots < A_n\). The \(A_i\) are unknown real numbers. You are randomly given an envelope, can look inside, then must choose whether to switch with another envelope.

    Does there exist a switching strategy that improves your utility more often than it worsens your utility?

    Once again, it turns out the real valued two envelope strategy still works with appropriate modifications. We still choose whether to swap by seeing if sample \(Y\) is greater than seen utility \(X\). The only difference is choosing which envelope to switch to. From the opener’s perspective, every other envelope appears identical. Thus, if the strategy says to swap, we should pick an alternative envelope at random.

    This leaves showing the improvement chance is higher than the worsening chance. If the algorithm does not swap, the utility is unchanged, so it suffices to analyze only situations where we switch envelopes.

    For envelope \(i\), the chance of switching is \(P[Y \ge A_i]\). The reward rises for \(n-i\) envelopes and drops for \(i-1\) envelopes. Thus, the chance of improving utility is

    \[P[\text{utility rises}] = \sum_{i=1}^n \frac{1}{n} P[Y \ge A_i]\cdot \frac{n-i}{n-1}\]

    and the chance of worsening utility is

    \[P[\text{utility drops}] = \sum_{i=1}^n \frac{1}{n} P[Y \ge A_i]\cdot \frac{i-1}{n-1}\]

    Envelope \(i\) has \(n-i\) envelopes that are better, and envelope \(n-i+1\) has \(n-i\) envelopes that are worse. Intuitively, every improving term for \(A_i\) should cancel with a worsening term for \(A_{n-i+1}\), but the improving terms have more weight because the switching probability after observing \(A_i\) is higher. This is formalized below.

    Take the difference and pair up terms with matching \(P[Y \ge A_i]\) to get

    \[P[\text{improves}] - P[\text{worsens}] = \frac{1}{n}\sum_{i=1}^n \frac{n-2i+1}{n-1} P[Y \ge A_i]\]

    The coefficients of the terms are \(\frac{n-1}{n-1}, \frac{n-3}{n-1}, \ldots, \frac{-(n-3)}{n-1}, \frac{-(n-1)}{n-1}\). Since we only care about whether the difference is positive, multiply by \(2\) to get two copies of the terms, then pair terms by coefficient, matching each coefficient with its negative.

    \[2(P[\text{improves}] - P[\text{worsens}]) = \frac{1}{n}\sum_{i=1}^n \frac{n-2i+1}{n-1} (P[Y \ge A_i] - P[Y \ge A_{n+1-i}])\]

    Consider each term of this summation.

    • For \(i < \frac{n+1}{2}\), the coefficient is positive, and \(A_i < A_{n+1-i}\), so \(P[Y \ge A_i] - P[Y \ge A_{n+1-i}]\) is positive. The entire term is positive.
    • For \(i = \frac{n+1}{2}\), the coefficent is \(0\).
    • For \(i > \frac{n+1}{2}\), the coefficient is negative, and \(A_i > A_{n+1-i}\), so \(P[Y \ge A_i] - P[Y \ge A_{n+1-i}]\) is negative. The entire term is positive.

    Every term in the summation is positive or zero, so the entire sum is positive, and the probability of increasing utility is higher than the probability of decreasing it. \(\blacksquare\)

    Implications

    So, now we have a strategy that is very slightly biased towards increasing utility. But before trying to implement this in real life, it’s worth thinking through all the complications.

    • The values \(A_i\) are chosen through some unknown process. Although this strategy is more likely to end on a larger \(A_j\), it is impossible to quantify how much better your utility will be after the swap. The utility might even go down in expectation. Although the chance of improving utility is higher, the potential utility increase may be small while the potential utility decrease is large. If we had more information about how \(A_j\) are generated, then we could argue this in more detail, but at that point this information independent scheme is probably no longer useful.
    • The analysis relies on having a value on the initial action. It is incredibly likely that we are just as confused about the value of our current action as we are about the values of other actions, which renders the strategy moot.
    • The analysis also relies on starting with an action picked uniformly at random out of a pool of possible actions. In reality, this is almost never the case. We usually have reasons to choose to act in one way or another, which places a non-uniform prior on the initial action. Intuitively, if we are already good at making decisions, it is far less likely we can switch to an even better one.

    So overall, this is not a life hack. All we have is a surprising decision theory result, and that’s fine too.

    (Thanks to the people who helped review earlier drafts.)

    Comments
  • Why Aren't I Optimizing My Process?

    While finding ways to spend time that didn’t involve studying for an entrance exam, an out of context quote popped into my head.

    I also believe that the usefulness of software tools is usually greatly underrated. Better tools can act as a significant multiplier on everyone’s productivity.

    (From the announcement for the Computation Graph Toolkit. Based on Theano, it’s a cool library for neural net implementation. It’s also written by a PhD student I actually know. Check it out!)

    This came after I’d done the bare minimum to organize my life. I cleared out my inboxes across three email accounts. I set up email forwarding to send everything to one master account. For classes and events this semester, instead of memorizing the times, I added them to Google Calendar. As an added bonus, I can check my calendar from my phone and get notifications ahead of every event.

    Setting this up took me around 1-2 hours, and it’s saved me so much more in just a few weeks. The real reward, however, has been the peace of mind. My inbox has unread messages if and only if I have something to check. If I’m not sure about my schedule, I can check my calendar from my phone. If I forget an event, I’ll get a notification with 30 minutes of lead time, and an email notification with 10 minutes of lead time. In the future, I can add HW due dates and job interview times. These are all simple, obvious ideas, and I’m incredibly disappointed I’m behind the curve.

    Back when I was applying to colleges, I based one essay around planning for only the short term. The main argument was that no plan survives contact with the real world, so it was better to plan at most a few weeks ahead, and make a new plan when necessary.

    Sure, parts of that are true. Uncertainty in the real world is the big reason agile development is a thing. But my god, I was so, so stupid. It’s a cute saying, to say that it’s pointless to plan when reality won’t match your plan, but that means your plan was bad in the first place. It still makes sense to talk about where a company is going in 3 months, or the goals a long-term project should achieve. “No plan survives the real world” doesn’t mean “Don’t plan at all”, it means “Plan in broad strokes, come up with plausible ways to achieve your goals, expect your methods or goals to change along the way, and make sure you keep slack for when things go wrong.”

    I’m convinced I wrote that essay because I was too lazy to organize my life, and needed a way to justify it. But there’s no justification for bad organization. I cannot think of a single scenario where messiness is better, because organization is a meta skill that improves literally everything. It means never disappointing someone by forgetting about an appointment. It means knowing where to look when you need something, whether you need a textbook or a bag of flour. It means having a system for note taking that is conducive to learning the material, both while taking the course and when you need to review it two years later. Although there are obviously other factors, the organized and well-regimented are the ones who are going to make the biggest impact in the world.

    And I’m not one of them.

    I need to start optimizing my process.

    Comments