About two weeks ago I watched a TED talk on the battle between one's present and future self. The idea being that a lot of our problems can be summed up to this: Your present self is here, he wants cool things, your future self is greatly affected by these decisions, but he can't do anything about it.
Over the holidays I gave Future Swizec a voice. Every three days he sends me an email to tell me what sort of financial situation he will find himself in after two weeks of Present Swizec doing stupid shit. That's not very far into the future, but it's just enough to do something about it, while not being too far away to think Meh, that's in ten years, I'll deal with it nine years from now.
If you want to give Future You this kind of voice have a look at my Personal Runway project on github. If you think this is a cool idea, but don't want to set it up yourself - email me! I might just make this proof of concept into a minimum viable product if there is any interest :)
I first ran it when I had just finished paying all my bills, which was a huge expense, so Future Swizec sent me this email:
Maybe he should be less happy about only having 5euro, but right now he's super every time his balance isn't negative. Perhaps Future Swizec needs a gray area.
Right now the predictions are somewhat rudimentary, for instance I don't take into account the fact money doesn't magically show up in my account after every billable hour. Another thing not taken into account are periodic expenses, super large spikes also throw it off somewhat.
The basic idea is this:
- Smooth out the data with a rolling average to get a curve
- Calculate an expected value for the next day after known data
- Expand the window for expected value by two (one into the future, one into the past) and calculate the next expected value
Weights are calculated according to the simplest infinite series I could think of that always sums to one no matter how many elements are needed. But I also split it in half and shuffle it about at the pivot, so the strongest weight is moved back in the data when calculating days. So in a sense, when calculating the 1st unknown value, the last known has highest weight. Then the penultimate known and so forth.
The algorithm is pretty simple in Haskell
-- ((n-i)*2)/((n-1)*n)weights :: (Num b, Fractional b, Enum b) => b -> [b]weights n =map (\i -> ((n-i)*2)/((n-1)*n)) [1.0..n]rotate :: Int -> [a] -> [a]rotate n l = t++hwhere (h,t) = splitAt ((length l) - n) lexpected :: (Fractional a, Enum a) => Int -> [a] -> aexpected pivot xs = sum $ map (\(w,v) -> w*v) $ zip (rotate pivot (weights $ fromIntegral $ length xs)) xs
Of course someone who actually knows Haskell would write it much better.
And there you have it, a simple way to talk with Future Swizec. There is still some tweaking to do and hopefully I can find more people to run this on and see how it works out for them as well.
- DEVIN TOWNSEND: 'I'm More On Autopilot Than Ever Before Now' (roadrunnerrecords.com)
- Sabbatical week day 3: Raining datatypes (swizec.com)
- Ask HN: What's your experience with remote working? as employees/employers? (news.ycombinator.com)
- Making a Möbius cake (swizec.com)
- Haskell : "The last statement in a 'do' construct must be an expression" (stackoverflow.com)
Here's how it works 👇
And get thoughtful letters 💌 on mindsets, tactics, and technical skills for your career. Real lessons from building production software. No bullshit.
"Man, love your simple writing! Yours is the only newsletter I open and only blog that I give a fuck to read & scroll till the end. And wow always take away lessons with me. Inspiring! And very relatable. 👌"
Ready to Stop copy pasting D3 examples and create data visualizations of your own? Learn how to build scalable dataviz components your whole team can understand with React for Data Visualization
Curious about Serverless and the modern backend? Check out Serverless Handbook, modern backend for the frontend engineer.
Ready to learn how it all fits together and build a modern webapp from scratch? Learn how to launch a webapp and make your first 💰 on the side with ServerlessReact.Dev
By the way, just in case no one has told you it yet today: I love and appreciate you for who you are ❤️