“Does the flap of a butterfly’s wings in Brazil set off a tornado in Texas?” This question, posed by Edward Lorenz, would be the foundation of what popular science now calls the “Butterfly Effect”. The idea is that small changes can cause ripples with large-scale consequences.
To be more precise, the Butterfly Effect is part of Chaos Theory, and it can be summarized as the sensitive dependence on initial conditions in which a small change in one state of a deterministic nonlinear system can result in large differences in a later state.
The financial world is plagued with butterfly effects, perhaps one of the biggest examples was Black Monday, when Hong Kong’s market crashed, its index falling rapidly and losses mounting at a breakfast place. Before anyone could understand what happened, the fall-out was felt all across the globe.
How about 2007? When the meltdown of an admittedly small part of the U.S mortgage market caused a widespread crisis that was felt all over the world. It took bail-outs, government aid, and different forms of support to reset and normalize the global economy.
Finance is complex, as it’s as dependent on economic forces as it’s on investors’ psychology. All it takes is one push and the dominoes start tumbling down. Why does it happen and how can technology help us avoid it?
The fragility of financial systems
Andrew Haldane, executive director of financial stability at the Bank of England presented an academic paper where he noted that the financial system had become progressively more complex, but increasingly less diverse. What does that entail?
Imagine financial systems like a building, the more diverse a system is, the more foundations it has to support the pressure. The more complex it is, the bigger and more complicated the infrastructure is (columns and beams distributing the weight along with the structure).
Hypothetically, you could have few foundations, but have an infrastructure that distributes the weight and keeps the building standing. Unfortunately, if one of the foundations fails, that would cause a ripple effect throughout the building, and regardless of the infrastructure, it would end up collapsing.
In other words, the less diverse our financial system is, the fewer safety nets it has to support sudden changes and random shocks. No matter how elegant your building is, you cannot build it on thin ice.
An introduction to random forests
Before understanding the forest, first, we have to talk about the trees (pardon the pun). Decision Trees are powerful Machine Learning algorithms that are used for classification. It’s a flowchart-like structure where every node represents a “test” of an attribute.
While it may sound complicated, it’s actually rather simple. In fact, we unconsciously use decision trees all the time.
For example, if you want to eat tacos, but you don’t want to drive far, you could use a decision tree. First, you go over a list of all the restaurants you know in town, then you classify them into two categories, the ones that have tacos on their menus and the ones that don’t.
Then we classify the ones with tacos on their menus as either “near” or “far” depending on how close they are to our current location. Then, finally, we classify them once again, this time as either “within our budget” or “too expensive”. Finally, we end up with a list of nearby taco places that are affordable.
In real life, a single expert, no matter how good they are, can make mistakes, that’s why we rely on committees. In a committee, even if an expert makes a mistake, you have several other dissenting opinions that will help you make the right choice in the end.
Random Forests are like digital committees, instead of having a single decision tree, we have several trees working in unison, each tree in the forest makes a prediction, and just like in Congress, votes are tallied. The most voted prediction is the outcome of the model. It’s Machine Learning bolstered by the power of democracy.
Random Forest works because each individual tree has little to no correlation with other trees, what one tree predicts isn’t linked to what the other trees predict. In human terms, we could say that they all have different points of view, which in turn ensures that there isn’t a systematic bias.
This algorithm is an elegant solution to making predictions on highly volatile systems and to working with complex problems that can have an almost infinite amount of data points. In other words, the kind of problems we constantly face in finance.
Random forests in finance
Research has shown that random forests outperform almost every other form of prediction concerning stock prices, qualitative analysis of stock, and option pricing and credit spread. There are two things to notice here.
First, there is the fact that traditional prediction tools rely on linear regressions, which is an extremely powerful algorithm, but only when the relations you are studying are linear in nature (in other words, no matter how many variables A changes, Variable B will keep changing in tandem).
Real-life relations are often more complex than that, for example, human height and weight. There is a linear relation there (taller people tend to weigh more), but that’s true up till a certain point. Afterward, weight can increase while height stagnates.
What that means is that a linear regression model to predict height from weight will only work up to a certain point. Something similar happens to stock prices, while some values will predict a rise in stock prices, at certain thresholds those relations change.
The other point is that Random Forests forces scientists to redefine their problems in terms of classification analysis. Instead of framing the problem as “If X increases then how much will Y increase” we ask “is value X going to change?”. This might not seem like much, but you would be surprised by how even a small reframing can change our perception of the problem.
With the right data points, random forests can help us gauge if a small change in a local market can have massive ramifications on the global economy. And thanks to IoT technologies, A.I, Cloud-computing and Data Mining, gathering and processing financial data has never been so easy.
To be fair, Random Forests aren’t perfect, like every other algorithm, the model is only as good as the data you train it with. It’s a well-known fact that Random Forests are extremely susceptible to small biases. Feed it bad data and you’ll end up with an unreliable model.
Random Forests will not revolutionize the finance world, but they are certainly a powerful tool that can be applied to a myriad of problems, providing new ways of framing issues and of predicting market behavior.