Introduction to Machine Learning

What is Machine Learning

Let's start with a definition:

Machine learning is the subfield of computer science that gives computers the ability to learn without being explicitly programmed (Arthur Samuel, 1959)

So what does that mean? Most computer programs are handcrafted by humans. Software engineers carefully craft every rule that governs how Software behaves and then translate it into computer code. Take a look at your screen right now. Everything that you see appears there because of some rule that an engineer somewhere crafted. This approach has gotten us quite far. But there are limits to it. Sometimes, there might just be too many rules necessary for humans to write. Sometimes, we might not be able to think of rules since they are too complex for even the smartest developers to come up with. As a brief exercise, take a minute to come up with a list of rules that describe all dogs but clearly distinguish dogs from all other animals.

Fur? Well, cats have fur, too. And what about a dog wearing a jacket? That is still a dog, just in a jacket. Researchers have spent years trying to craft these rules with little success. Humans don't seem to be able to perfectly tell why something is a dog, but they know it when they see it. Humans seem to detect specific, hard to describe, patters which in aggregate let them classify an animal as a dog. Machine Learning attempts to do the same. Instead of handcrafting rules, we let a computer develop its own rules through pattern detection. There are different ways this can work:

ML subfields

Supervised learning

Let's go back to our dog classifier. There are in fact many such classifiers in use today. If you use google images for example and search for 'dog' it will use an image classifier to show you pictures of dogs. These classifiers are trained under a paradigm known as supervised learning. In supervised learning, we have a large number of training examples, such as images of animals, and labels which describe what the expected outcome for those training examples is. For example the image above would come with the label 'dog' while an image of a cat would come with a label 'not a dog'. If we have many of these labeled training examples, we can train a classifier on detecting the subtle statistical patterns that differentiate dogs from all other animals.

Unsupervised learning

Supervised learning has made great advances of the last few years, and most of this course will focus on working with labeled examples. However, sometimes we do not have labels. In this case, we can still use machine learning to find hidden patterns in data. Imagine a company with many customers for its products. These customers can probably be grouped into different market segments, but we do not even know which different market segments there are. We also can not ask customers which market segment they are because they probably do not know. Which market segment of the shampoo market are you? Do you even know how shampoo firms segment their customers? So we would like an algorithm that looks at a lot of data of customers and groups them into segments. This is an example of unsupervised learning. This area of machine learning is far less developed than supervised learning but holds great potential.

Reinforcement learning

In reinforcement learning, we train agents which take actions in an environment, such a self driving car on the road. While we do not have labels, that is we can not tell what the 'correct' action is in any situation, we can assign rewards or punishments. For example we could reward keeping a proper distance to the car in front. A driving instructor does not tell the student to 'push the break half way through while moving your steering wheel two degrees to the right', but rather tells the student whether she is doing well or not while the student figures out the exact amount of breaking to use. Reinforcement learning has also made some remarkable progress in the past couple of years and is considered to be a promising avenue towards general artificial intelligence, computers that are as smart as humans, by many researchers.

Generative models

Generative models generate content, such as images, music, drawings, architecture, etc. They have seen a lot of progress through the introduction of GANs, Generative Adversarial Networks, in which one neural net tries to generate images that fool another neural net which aims to classify images. So if you for example want to generate an image of a dog, you train a classifier that recognizes dogs, like above, and let another model generate images until the classifier recognizes the image as a dog.

Machine learning in finance

'The Unbearable Transience of Alpha' is a blog post by Tammer Kamel, the CEO of Quandl, a data service company. Tammer describes the history of alpha sources over time. 'Alpha' is the abnormal rate of return on a security or portfolio in excess of what would be predicted by an equilibrium model like the capital asset pricing model. Returns free of market risk. Although it has only entered the financial vocabulary in the 80s, it is what investors have been chasing forever. In the early wild west days of investing, alpha was often realized through information advantages. Either some investors had superior means of information transmission or they simply used insider information. Some investors also tried to create an information advantage by spreading deceiving information to other investors. Regulation greatly reduced insider trading and false information (although both are still around) and the spread of modern high speed information pushed information advantages through superior information transmission to the edge (although many companies go to great lengths to get their servers closer to the stock exchanges). This caused the advent of the hedge-fund. Hedge-funds try to carefully construct portfolios that bear no market risk, mostly by calculating the correlation of their portfolio with the market and then shorting a market index. This process is called beta hedging, but modern hedge-funds can now hedge against a whole range of risk factors. For a surprising amount of time, quantitative strategies like beta hedging where a reliable source of alpha. However, as more and more investors use quantitative tools and computers to find potential sources of alpha, it has become harder and harder to spot them. The low hanging fruit like simple beta hedging are gone and no investor can outperform the market by looking at fundamentals data anymore. There are simply too many eyes on the same data and any information that could have been won from them is already incorporated into the price, because someone saw it earlier and acted on it. The competition is so intensive, financial firms are starting to look beyond what is traditionally considered 'financial data'. At the end of the day, finance tries to value entities in the real world, and the real world is more than just fundamentals. Some of the new data sources range from the sentiments of twitter users, satellite images of retailers parking lots or CEO golf handicaps. And there is more to come. With the digitalization of society in full swing and the internet of things underway, investors stand in front of a massive amount of data, more than any analyst could ever go through. The old approach of handcrafting models that capture the financial impact of different factors is simply impractical given the sheer scale of data available. If only there was a technique that could create models automatically and works better the more data it is fed...

The unreasonable effectiveness of data

In 2009, 3 google engineers published a landmark paper titled 'The unreasonable effectiveness of data'. In it, they described how relatively simple machine learning systems that had been around for a long time exhibited much better performance when fed with the enormous amounts of data google had on its servers. In fact, they discovered that when fed with more data, these simple systems could master tasks that had been thought to be impossible before. Researchers quickly started revisiting old machine learning technologies and found that artificial neural networks did especially well when trained on massive datasets. Around the same time, computing power became cheap and plentiful enough to train much bigger networks than before. These bigger artificial neural networks, where so effective that they got a name: deep neural networks or deep learning. Deep nets are especially good at pattern detection. They can find complex patterns, such as the statistical pattern of light and dark that describes a face in a picture, and they can do so automatically given enough data. Machine learning is therefore best understood as a paradigm change in how we program computers. Instead of carefully handcrafting rules, we feed the computer vast amounts of information and train it to craft the rules by itself. This approach is superior if there are a very large amount of rules or these rules are difficult to describe. Modern machine learning is therefore the ideal tool to comb through the huge amounts of data the financial industry is confronted with.

Automation

But machine learning can not only help with new tasks. Since it is able to learn a large amount of difficult to describe rules, it is also an ideal tool for automation. It already powers many robots and autonomous drones. In the near future, self driving cars will bring automation to the masses and in the process render millions of professional truck drivers without an occupation. But it is not only low skilled factory workers and truck drivers that have to fear the rise of the robots. In fact, banks have a much bigger incentive to automate jobs, since their staffers make a lot more than a truck driver. To quote Deutsche Bank CEO John Cryan

In our banks we have people behaving like robots doing mechanical things, tomorrow we’re going to have robots behaving like people.

Machine learning can be used to allow machines to carry out many other boring but nessecary tasks in the industry. One example is accounting work. Machines could read invoices, match them to transactions and create a ledger. Humans then only have to supervise the automatized work. The productivity of accountants would increase and the costs of administration decrease. Equally, machines could create portfolios that fit savers individual needs, advise on mortgages or assess insurance claims. All tasks which are mostly done by humans today but for which automation is already under way.

This is both an opportunity and a threat to financial professionals. An opportunity for those who drive the change and a threat to those who are left behind. In the mid run, automation will have a similar effect as most other technical advances. Is will destroy many jobs but create new and better ones. The new jobs however, require new skills. For any (aspiring) financial professional, it seems wise to invest in education now.

All models are wrong

There is a saying in statistics that 'All models are wrong but some are useful'. Machine learning creates incredibly complex statistical models which are often, e.g. in deep learning, not interpretable to humans. They sure are useful and have great value, but they are still wrong. Because they are complex black boxes, people tend to not question machine learning models, even though they should question them precisely because they are black boxes. There will come a time where even the most sophisticated deep neural networks make a fundamentally wrong prediction, just as the advanced CDO models did in the financial crises of 2008. Even worse, black box machine learning models that will make millions of decisions on loan approval or insurance impacting everyday's peoples lives will make many wrong decisions. Sometimes they will be biased. Machine learning is only as good as the data that we feed it and data often is biased. If we mindlessly deploy these algorithms we will automate discrimination, too, and might cause another financial crisis. This is especially true in the financial industry, where algorithms often can have severe impacts on peoples lives and at the same time kept secret. Unquestionable, secret, black boxes that gain their acceptance through the heavy use of math pose a bigger threat to society than the self conscious artificial intelligence taking over the world you see in movies. While this is not an ethics class, it makes sense for any practitioner of the field to get familiar with the ethical implications of his or her work. Next to recommending reading 'Weapons of math destruction' we will also ask all of our students to swear 'The Modelers’ Hippocratic Oath'. It was developed in 2008 in wake of the financial crisis:

I will remember that I didn’t make the world, and 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 over- sights. I understand that my work may have enormous effects on society and the economy, many of them beyond my comprehension.

Summary

In this text we saw what machine learning is and discussed some of its most important subfields. We have also seen how it relates to business and finance. In the next chapter we'll build our own neural network from scratch.


In [ ]: