Algorithms to live by

Algorithms to live by

The computer science of human decisions – book review

I read this book on my kindle over the last few weeks and found it thought provoking, educational and entertaining.  These guys did a great job writing about the interesting bits of algorithms and how they are applied to our real world.  And they did it without talking down to us and without any formulas.

It’s an excellent and interesting book that builds a nice narrative bridge between a potentially sticky abstract science topic and the real world.  Good job.

One of the firs things they look into is the question of how long to look at alternatives before settling on one.  Guess what?  The answer is 37%.  It’s always 37%.  After you have looked at 37% of the viable candidates you should go ahead and stop.  And they explain why.

It’s just this sort of intractable problem that they hold the lens of science up to and explain in an easy way.  Whether you are looking for a bride or hiring a secretary the answer is 37%.

Next, they explore the Explore/Exploit algorithms.  This is where you try to figure out whether to eat at the restaurant you know you love versus try a new one.  How do you balance the known versus the unknown potential?  What’s the value of exploration itself?

In a particularly useful chapter they discuss sorting algorithms.  What’s the fastest way to sort a giant pile of stuff?  Split it into lots of little piles, sort those and then merge them together.  This is known as a merge-sort.  That will come in handy with your sock drawer next time you do the laundry.

How about caching algorithms?  You can’t keep everything in your head at once so you have to stick some of it into cache memory.  What should you put in this handy memory?  It turns out the best thing to put close at hand in cache is what you have most recently used. Now when you clean your house you can just use the LIFO method to know what to leave on the counter and what to bury in the back of the closet.

They talk about the concept of overfitting the algorithm.  This is when you use too much information and get a worse answer.  Sometimes, most of the time, drawing conclusions from fewer data points actually gives you a better answer.  I see this happening all around me in business.  Everyone wants to have all the data so they can make sure they get the best answer.  They are just spending money and time to get a worse answer.

The last chapter on game theory is quite fascinating.  They trot out the prisoners’ dilemma, because what good pop science book can’t cite the prisoners’ dilemma?

You have two prisoners. Each being grilled in two separate interrogation rooms.  If they hold out there isn’t enough evidence and they will both go free and get to split the $10M bucks they stole.  If one of them cooperates, that one goes free and gets all the $10M.  If they both cave they both go to jail.

What’s the optimal answer?  Turns out you should always rat out your friend.  It’s the lowest risk, highest payoff choice.  Unless of course ratting them out is going to get you killed by a mafia don, then you probably shouldn’t.

The tricky thing with most game theory is that it requires to guess what the other person is thinking.  And when you start doing that you end up in an endless loop called recursion.  Is he bluffing?  Or is he pretending to bluff because he thinks I’m pretending to bluff…

These are examples of truly intractable problems where the game is set up in such a way that the best option is not what we would want.  The only alternative is to change the rules of the game! Quite applicable to many of the intractable social and political problems we have now.

For instance, there is the common green problem.  If everyone picks up after themselves there will be no litter.  But, me as an individual, can save time and expense by throwing my trash out the car window.  But if we all do that we’ll live in a big pile of trash.  Only the rules of the game, in this case the social norms, keep us in check.

I’ll leave you with this thought about following the herd vs making your own way.

“And if you are the kind of person who always does what you think is right, no matter how crazy other think it is, take heart.  The bad news is that you will be wrong more often than the herd followers.  The good news is that sticking to your convictions creates a positive externality, letting people make accurate inferences from your behavior.  There may come a time when you will save the entire herd from disaster.”

Enjoy your algorithms!

Chris Russell, April 2017

Leave a Comment