Beginners
Oliver Theobald
,Contents
INTRODUCTION
INTRODUCTION
Machines have come a long way since the Industrial Revolution. They
WHAT IS MACHINE LEARNING? continue to fill factory floors and manufacturing plants, but now their
ML CATEGORIES capabilities extend beyond manual activities to cognitive tasks that, until
THE ML TOOLBOX recently, only humans were capable of performing. Judging song
DATA SCRUBBING competitions, driving automobiles, and mopping the floor with professional
SETTING UP YOUR DATA chess players are three examples of the specific complex tasks machines are
now capable of simulating.
REGRESSION ANALYSIS
But their remarkable feats trigger fear among some observers. Part of this
CLUSTERING fear nestles on the neck of survivalist insecurities, where it provokes the
BIAS & VARIANCE deep-seated question of what if? What if intelligent machines turn on us in a
ARTIFICIAL NEURAL NETWORKS struggle of the fittest? What if intelligent machines produce offspring with
DECISION TREES capabilities that humans never intended to impart to machines? What if the
ENSEMBLE MODELING legend of the singularity is true?
BUILDING A MODEL IN PYTHON The other notable fear is the threat to job security, and if you’re a truck driver
or an accountant, there is a valid reason to be worried. According to the
MODEL OPTIMIZATION British Broadcasting Company’s (BBC) interactive online resource Will a
FURTHER RESOURCES robot take my job?, professions such as bar worker (77%), waiter (90%),
DOWNLOADING DATASETS chartered accountant (95%), receptionist (96%), and taxi driver (57%) each
FINAL WORD have a high chance of becoming automated by the year 2035.[1]
But research on planned job automation and crystal ball gazing with respect
to the future evolution of machines and artificial intelligence (AI) should be
read with a pinch of skepticism. AI technology is moving fast, but broad
adoption is still an unchartered path fraught with known and unforeseen
challenges. Delays and other obstacles are inevitable.
Nor is machine learning a simple case of flicking a switch and asking the
machine to predict the outcome of the Super Bowl and serve you a delicious
martini. Machine learning is far from what you would call an out-of-the-box
solution.
Machines operate based on statistical algorithms managed and overseen by
skilled individuals—known as data scientists and machine learning
engineers. This is one labor market where job opportunities are destined for
,growth but where, currently, supply is struggling to meet demand. Industry crunching for you.
experts lament that one of the biggest obstacles delaying the progress of AI is If you have not learned to code before, you will need to if you wish to make
the inadequate supply of professionals with the necessary expertise and further progress in this field. But for the purpose of this compact starter’s
training. course, the curriculum can be completed without any background in
According to Charles Green, the Director of Thought Leadership at Belatrix computer programming. This book focuses on the high-level fundamentals of
Software: machine learning as well as the mathematical and statistical underpinnings of
“It’s a huge challenge to find data scientists, people with machine designing machine learning models.
learning experience, or people with the skills to analyze and use the For those who do wish to look at the programming aspect of machine
data, as well as those who can create the algorithms required for learning, Chapter 13 walks you through the entire process of setting up a
machine learning. Secondly, while the technology is still emerging, there supervised learning model using the popular programming language Python.
are many ongoing developments. It’s clear that AI is a long way from
how we might imagine it.” [2]
Perhaps your own path to becoming an expert in the field of machine learning
starts here, or maybe a baseline understanding is sufficient to satisfy your
curiosity for now. In any case, let’s proceed with the assumption that you are
receptive to the idea of training to become a successful data scientist or
machine learning engineer.
To build and program intelligent machines, you must first understand
classical statistics. Algorithms derived from classical statistics contribute the
metaphorical blood cells and oxygen that power machine learning. Layer
upon layer of linear regression, k-nearest neighbors, and random forests surge
through the machine and drive their cognitive abilities. Classical statistics is
at the heart of machine learning and many of these algorithms are based on
the same statistical equations you studied in high school. Indeed, statistical
algorithms were conducted on paper well before machines ever took on the
title of artificial intelligence.
Computer programming is another indispensable part of machine learning.
There isn’t a click-and-drag or Web 2.0 solution to perform advanced
machine learning in the way one can conveniently build a website nowadays
with WordPress or Strikingly. Programming skills are therefore vital to
manage data and design statistical models that run on machines.
Some students of machine learning will have years of programming
experience but haven’t touched classical statistics since high school. Others,
perhaps, never even attempted statistics in their high school years. But not to
worry, many of the machine learning algorithms we discuss in this book have
working implementations in your programming language of choice; no
equation writing necessary. You can use code to execute the actual number
, performance based on data and empirical information; all without direct
programming commands. This is what Arthur Samuel described as the ability
to learn without being explicitly programmed. But he doesn’t infer that
machines formulate decisions with no upfront programming. On the contrary,
machine learning is heavily dependent on computer programming. Instead,
WHAT IS MACHINE LEARNING? Samuel observed that machines don’t require a direct input command to
In 1959, IBM published a paper in the IBM Journal of Research and perform a set task but rather input data.
Development with an, at the time, obscure and curious title. Authored by
IBM’s Arthur Samuel, the paper invested the use of machine learning in the
game of checkers “to verify the fact that a computer can be programmed so
that it will learn to play a better game of checkers than can be played by the
person who wrote the program.” [3]
Although it was not the first publication to use the term “machine learning”
per se, Arthur Samuel is widely considered as the first person to coin and
define machine learning in the form we now know today. Samuel’s landmark
journal submission, Some Studies in Machine Learning Using the Game of
Checkers, is also an early indication of homo sapiens’ determination to
impart our own system of learning to man-made machines. Figure 2: Comparison of Input Command vs Input Data
An example of an input command is typing “2+2” into a programming
language such as Python and hitting “Enter.”
>>> 2+2
4
>>>
This represents a direct command with a direct answer.
Input data, however, is different. Data is fed to the machine, an algorithm is
selected, hyperparameters (settings) are configured and adjusted, and the
machine is instructed to conduct its analysis. The machine proceeds to
Figure 1: Historical mentions of “machine learning” in published books. Source: Google Ngram Viewer, 2017 decipher patterns found in the data through the process of trial and error. The
machine’s data model, formed from analyzing data patterns, can then be used
Arthur Samuel introduces machine learning in his paper as a subfield of to predict future values.
computer science that gives computers the ability to learn without being Although there is a relationship between the programmer and the machine,
explicitly programmed. [4] Almost six decades later, this definition remains they operate a layer apart in comparison to traditional computer
widely accepted. programming. This is because the machine is formulating decisions based on
Although not directly mentioned in Arthur Samuel’s definition, a key feature experience and mimicking the process of human-based decision-making.
of machine learning is the concept of self-learning. This refers to the As an example, let’s say that after examining the YouTube viewing habits of
application of statistical modeling to detect patterns and improve data scientists your machine identifies a strong relationship between data