## Elegant and practical solutions

There are two ways in which you can tie a shoelace – one is the “ordinary method”, where you explicitly make the loops around both ends of the lace before tying together to form a bow. The other is the “elegant method” where you only make one loop explicitly, but tie with such great skill that the bow automatically gets formed.

I have never learnt to tie my shoelaces in the latter manner – I suspect my father didn’t know it either, because of which it wasn’t passed on to me. Metaphorically, however, I like to implement such solutions in other aspects.

Having been educated in mathematics, I’m a sucker for “elegant solutions”. I look down upon brute force solutions, which is why I might sometimes spend half an hour writing a script to accomplish a repetitive task that might have otherwise taken 15 minutes. Over the long run, I believe, this elegance will pay off, in terms of scaling easier.

And I suspect I’m not alone in this love for elegance. If the world were only about efficiency, brute force would prevail. That we appreciate things like poetry and music and art and what not means that there is some preference for elegance. And that extends to business solutions as well.

While going for elegance is a useful heuristic, sometimes it can lead to missing the woods for the trees (or missing the random forests for the decision trees if you may will). For there are situations that simply don’t, or won’t, scale, and where elegance will send you on a wild goose chase while a little fighter work will get the job done.

I got reminded of this sometime last week when my wife asked me for some Excel help in some work she was doing. Now, there was a recent article in WSJ which claimed that the “first rule of Microsoft Excel is that you shouldn’t let people know you’re good at it”. However, having taught a university course on spreadsheet modelling, there is no place to hide for me, and people keep coming to me for Excel help (though it helps I don’t work in an office).

So the problem wasn’t a simple one, and I dug around for about half an hour without a solution in sight. And then my wife happened to casually mention that this was a one-time thing. That she had to solve this problem once but didn’t expect to come across it again, so “a little manual work” won’t hurt.

And the problem was solved in two minutes – a minor variation of the requirement was only one formula away (did you know that the latest versions of Excel for Windows offer a “count distinct” function in pivot tables?). Five minutes of fighter work by the wife after that completely solved the problem.

Most data scientists (now that I’m not one!)  typically work in production environments, where the result of their analysis is expressed in code that is run on a repeated basis. This means that data scientists are typically tuned to finding elegant solutions since any manual intervention means that the code is not production-able and scalable.

This can mean finding complicated workarounds in order to “pull the bow of the shoelaces” in order to avoid that little bit of manual effort at the end, so that the whole thing can be automated. And these habits can extend to the occasional work that is not needed to be repeatable and scalable.

And so you have teams spending an inordinate amount of time finding elegant solutions for problems for which easy but non-scalable “solutions exist”.

Elegance is a hard quality to shake off, even when it only hinders you.

I’ll close with a fairytale – a deer looks at its reflection and admires its beautiful anchors and admonishes its own ugly legs. Lion arrives, the ugly legs help the deer run fast, but the beautiful antlers get stuck in a low tree, and the lion catches up.

## Maths, machine learning, brute force and elegance

Back when I was at the International Maths Olympiad Training Camp in Mumbai in 1999, the biggest insult one could hurl at a peer was to describe the latter’s solution to a problem as being a “brute force solution”. Brute force solutions, which were often ungainly, laboured and unintuitive were supposed to be the last resort, to be used only if one were thoroughly unable to implement an “elegant solution” to the problem.

Mathematicians love and value elegance. While they might be comfortable with esoteric formulae and the Greek alphabet, they are always on the lookout for solutions that are, at least to the trained eye, intuitive to perceive and understand. Among other things, it is the belief that it is much easier to get an intuitive understanding for an elegant solution.

When all the parts of the solution seem to fit so well into each other, with no loose ends, it is far easier to accept the solution as being correct (even if you don’t understand it fully). Brute force solutions, on the other hand, inevitably leave loose ends and appreciating them can be a fairly massive task, even to trained mathematicians.

In the conventional view, though, non-mathematicians don’t have much fondness for elegance. A solution is a solution, and a problem solved is a problem solved.

With the coming of big data and increased computational power, however, the tables are getting turned. In this case, the more mathematical people, who are more likely to appreciate “machine learning” algorithms recommend “leaving it to the system” – to unleash the brute force of computational power at the problem so that the “best model” can be found, and later implemented.

And in this case, it is the “half-blood mathematicians” like me, who are aware of complex algorithms but are unsure of letting the system take over stuff end-to-end, who bat for elegance – to look at data, massage it, analyse it and then find that one simple method or transformation that can throw immense light on the problem, effectively solving it!

The world moves in strange ways.

## Understanding different kinds of art

There are some kinds of art that I intuitively understand – like an elegant mathematical proof, or a beautiful combination in a game of chess; a Sachin Tendulkar straight drive, or a long-distance beautifully threaded pass by Xabi Alonso. I can easily appreciate a well-done-up home when I see it. Some music makes me go delirious, and there have been times when I’ve actually started rolling on the floor in ecstasy after listening to certain songs.

But there is art that I simply don’t get. Poetry – for example – I’ve never got what is the big deal with that. To me it just looks like a bunch of sentences broken up in random ways, which is supposed to make it sound nice. In fact, I’ve argued earlier that poetry is a vestige of the pre-writing era.

It is the same with “literature”. Some people read books or articles because they are just “written beautifully”.  I absolutely fail to appreciate that phrase. As long as something is explained simply and intuitively, it is enough for me. In fact, when a writer tries to get too cute and makes a conscious effort to “write beautifully” it puts me off, for it makes the reading less intuitive. As a consequence, there’s hardly any fiction I’ve read in the last 5-6 years.

I was thinking of this last evening when I went to watch this dance show called “Prayog 4” here in Bangalore. I think it was good – the three performances looked extremely well choreographed and well-coordinated, and the dancers seemed to have put in considerable effort into the production. They were all supremely fit and were literally doing gymnastics during the course of the performance. But my appreciation of the performance ended there.

After one of the performances, the wife exclaimed “you know, this dance so represents your and my lives!”. I just couldn’t understand what she was hinting at. All I could see was this one guy dancing round and round in circles, and doing gymnastics on a rope! As I mentioned earlier, his movements were extremely graceful and aesthetically pleasing but I just couldn’t get anything more out of it.

Later last night, my wife asked me what I understood from the first performance (yesterday’s show essentially had three separate performances). “A bunch of chicks doing extremely graceful gymnastics on a bunch of parallel bars”, I replied. “Didn’t you notice how beautifully they represented different emotions during the course of the dance”, she asked. I admitted to recognizing nothing of the sort. Instead, I was sitting there, wondering what the big deal was, and trying to construct this blog post in my head.

“Art” is not unidimensional, and “appreciating art” is too broad a statement. After my experience yesterday I don’t know if there are people who can appreciate all kinds of art. For a moment I thought I was a philistine for I couldn’t appreciate yesterday’s performance, but then I remembered the pieces of art I mentioned in the beginning of this blog post that I truly appreciate. So, no – I’m not a philistine. It’s just that there are certain art forms I get and ones I don’t.

Have you felt similarly sometimes? Are there some art forms you “get” easily, and others that you absolutely fail to get? Or do you consider yourself to be the types that gets all kinds of art, and you argue that the ones you don’t get is simply not art? Or do you fail to get any art at all? Do leave a comment.

## Addition to the Model Makers Oath

Paul Wilmott and Emanuel Derman, in an article in Business Week a couple of years back (at the height of the financial crisis) came up with a model-makers oath. It goes:

• I will remember that I didn’t make the world and that it doesn’t satisfy my equations.

• Though I will use models boldly to estimate value, I will not be overly impressed by mathematics.

• I will never sacrifice reality for elegance without explaining why I have done so. Nor will I give the people who use my model false comfort about its accuracy. Instead, I will make explicit its assumptions and oversights.

• I understand that my work may have enormous effects on society and the economy, many of them beyond my comprehension.

While I like this, and try to abide by it, I want to add another point to the oath:

As a quant, it is part of my responsibility that my fellow-quants don’t misuse quantitative models in finance and bring disrepute to my profession. It is my responsibility that I’ll put in my best efforts to be on the lookout for deviant behavour on the part of other quants, and try my best to ensure that they too adhere to these principles.

Go read the full article in the link above (by Wilmott and Derman). It’s a great read. And coming back to the additional point I’ve suggested here, I’m not sure I’ve drafted it concisely enough. Help in editing and making it more concise and precise is welcome.