Sunday, July 17, 2011

Trial and Error and the God Complex...

I just saw Tim Harford's TED talk: Trial and Error and the God Complex.

Harford makes some good arguments for evolutionary, "trial and error" approaches to solving complex problems. There are also significant risks.

Harford's examples are very carefully chosen not to present the limitations of evolutionary approaches to solve problems. For example, a human baby is a product of evolution, but without a specific design -- a product of natural environmental constraint and common decent. Harford's "nozzle" story is different, there is a desired design, which is found through a genetic algorithm... in this case, the principle of evolution is applied in an artificial environment where the constraint is a metric on a fitness function (e.g. how well does the nozzle make detergent?) This allows the genetic algorithm to incrementally improve the design without actually knowing how the design works, by passing traits that contribute to passing the fitness function.

It is helpful to realize that top-down design and genetic algorithm design are simply different ways of finding solutions (optima). One isn't better than the other, any more than analytic solutions to functions are better than numerical solutions, nor are they always equivalently easy or possible to find.

Genetic algorithms only work for designs when a fitness metric can be established (e.g. how well the nozzle makes detergent) -- it is not useful or appropriate as a technique when a fitness function is unknown. Hence, you already have to have expended considerable thought to define a fitness function that correctly specifies the question in order to solve problems the way Harford suggests. This isn't trivial in the general case, it can be harder than solving the problem using top-down design methods.

Harford's example of the stock market is not completely unrealistic -- it is entirely likely that "something" is evolving faster than humans -- but since we have only very vague ideas about what effects a fitness function like "fiduciary trust" has, we don't know exactly what corporations will evolve to claim us as pets.

This brings us to the second shortcoming of evolutionary techniques.... while they are excellent at homing in on optima using a fitness function, the only thing you can say about them is the probability that they are good enough to pass the fitness function and nothing more. If your fitness function forgets to include exceptions, there is no guarantee that your solution will remain stable for such conditions. Even more fundamentally, you have no idea how the solution actually works.

Genetic algorithms can lead scientists to breakthroughs, however in order to understand how they work, the solutions must be reverse-engineered back into an analytic understanding.

Harford focuses so closely on the amazing ability of these systems to find answers that he has forgotten that those answers need rigorous testing. It turns out that humans are even worse at defining correct testing scenarios than we are at building systems top-down. So while his approach may be compelling, it is not without significant danger. It substitutes one evil (i.e. what he calls the "God complex") with another: the hubris to think that we know what we want (i.e. understand the fitness function) sufficiently to know when we get it.

Asimov warned us of this hubris in stories featuring the notorious well-meaning "Laws of Robotics" that led robots to very different conclusions than expected. And Crichton warned us of trying to control such systems as they rapidly change and exceed our ability to control them.

Real evolution is raw, untamed, and unpredictable -- it doesn't play by rules we fully comprehend.

Monday, July 11, 2011

Good Lesson, but not universal...

Aaron Iba explains in his blog that his iPhone game led him to a new way of thinking about development that he thinks makes him a better programmer and startup founder.

"Iterate-and-Repair" is a good optimization strategy where opportunity costs are low (i.e. trying out different solutions in a puzzle game), but they aren't so great where opportunity costs are high (i.e. trying to send a man to the moon). In that case, the best strategy is still to engineer an optimal solution using mathematics.

The key distinction is not learning styles, nor even an MIT background, but rather asking the question: "what is the opportunity cost for my solution?"

The late 90's saw a wave of "good enough" engineering that was based on a similar idea of iterate-and-repair, but notoriously did not factor opportunity cost in the analysis. Who needs all those edge-cases and testing when you can follow the 80-20 pareto rule and get to market quickly? Well, if you've ignored the opportunity costs and your solution fries a thousand people in an aircraft, or tanks a billion dollars in stocks overnight, you better believe that an 80/20 approach is not "good enough" after all.

Of course you should use the right tool for the job, but there is still a need for engineered solutions.