In this lecture, we are going to answer the question, what is machine learning?
I always like to discuss this first because I take a very different approach compared to most other
resources you'll find in general.
I think the approach most other resources take is that they like to frame machine learning as something
complex and something fancy and something futuristic and exciting.
My approach instead is rather kind of depressing.
How I want you to think of machine learning is that it's something not fancy at all and something that
only requires spatial reasoning.
My goal is to make machine learning sound as dumb as possible.
Here are some anonymous definitions of machine learning that I found on the Internet.
Let me read this one out to you.
Machine learning is an application of artificial intelligence that provides systems the ability to automatically
learn and improve from experience without being explicitly programmed.
Machine learning focuses on the development of computer programs that can access data and use it to
learn for themselves.
The process of learning begins with observations or data such as examples, direct experience or instruction
in order to look for patterns in data and make better decisions in the future based on the examples
that we provide.
The primary aim is to allow the computers to learn automatically without human intervention or assistance
and adjust actions accordingly.
Wow, that seems pretty magical.
Here's another one machine learning can be explained as automating and improving the learning process
of computers based on their experiences without actually being programmed, i.e. without any human assistance.
The process starts with feeling good quality data and then training our machines computers by building
machine learning models, using the data and different algorithms.
Again, very generic, but no substance.
In fact, these two definitions were so poorly written, I had to fix them up a little bit due to some
obvious grammatical errors, I didn't edit them too heavily since I didn't want to lose the gist of
what they were saying.
But you can tell that these were not written by people who actually know about machine learning.
None of this tells me how machine learning actually works.
This is what I would expect if I were not a student of machine learning.
In other words, just the layman.
And I wanted to know about how someone completely ignorant of machine learning would view it at a high
level.
In other words, as students of machine learning, this is not really how you want to think of what
we are doing.
So starting now, you are no longer just a layman.
You are a machine learning student.
So instead, I'm going to teach you my dumb as possible approach, which is encapsulated by the model
machine learning is nothing but a geometry problem.
Let's repeat that machine learning is nothing but a geometry problem.
The best way to illustrate this is by example.
Let's start with an example of regression regression basically means you're trying to fit a line or
a curve, so right away you understand that this is geometry.
Geometry is just lines, planes, curves, circles and so forth.
That's why you're sometimes you're grumpy.
Old statisticians say things like machine learning is nothing but a glorified curve fitting.
By the way, if you are a grumpy old statistician, then you're probably going to be offended by everything
we do.
You can take this up with Geoffrey Hinton.
So let's say you're a data analyst and you want to know how a salary related to years of experience.
You might model this as a straight line where the input X is years of experience and the output Y hat
is the predicted salary.
As you may recall from your high school math studies, the equation of the line is Y hat equals M X
plus be here, M is the slope and B is called the Y intercept.
Your job, of course, is to find these values of M and B.
To expand on this a little bit, here's how you would do this in the quote unquote real world.
Let's say, for example, you're a data scientist at LinkedIn or Glassdoor, so you have access to their
database.
And you can see for each user how many years of experience they have and what their current salary is.
Let's call these data points X one up to X in and Y one up to widen.
As mentioned previously, X is the years of experience and Y represents the salary.
We use Y to represent the true salary, whereas Y hat represents the predicted salary.
Both X and Y are indexed by the numbers, one to ND, so there are and the people in our database,
then what you're going to do is you're going to take a big piece of graph paper and plot each of these
x y data points.
You're physically going to draw a dot for each data point.
Then once you're finished drawing all your dots, you're going to take a line that goes through all
these data points.
Pretty simple, I think.
And believe it or not, this is exactly what machine learning is.
So, as mentioned, the example we just discussed is called a regression.
This is where you're trying to fit a line or a curve to some data points.
Now, there are two ways we can make this more complicated and more like the data sets we might encounter
in the real world.
First, we might have more than one input feature.
In the previous example, the number of years of experience was the only input feature.
But realistically, you might measure more things.
For example, you might recall things like what kind of degree the person has, like a bachelor's,
master's or Ph.D. You might record what school they went to, what country they're from, what their
ages and their gender.
All of these factors or features might affect the salary.
When you do this, the object you're trying to fit is no longer alive.
If you have to input features, then you have three dimensions in total.
So you get a plane.
If you have more than two input features, then you get a hyper plane.
By the way, in case it's not obvious, you can't visualize anything beyond three dimensions because
the physical world itself is three dimensions.
The second way we can make the regression problem more complicated is that instead of trying to fit
a straight or non curved object like a line or a plane, we can fit a curve.
Many real world data sets are non-linear.
Think of something simple like exercise.
If I do 20 push ups, will I gain twice as much muscle as I would have if I did 10 pushups?
If I do 30 pushups, will I gain three times as much muscle?
Of course, the answer is no.
Otherwise, we'd have people doing push ups all the time and becoming very large people.
At some point, the benefit of doing push ups is going to taper off.
Now, let's turn our attention to another kind of machine learning problem known as classification,
both classification and regression are examples of supervised learning, which is going to be the main
focus of this course.
We will sometimes discuss unsupervised learning as well, but the main focus will be supervised learning.
So whereas regression is concerned with predicting a real value, no classification is concerned with
predicting a category one popular example is image classification, where your model accepts as input
an image of a dog or a cat and tries to predict whether the label should be dog or cat.
However, in this lecture, we going to look at an example that helps us build this geometrical intuition
we've been talking about.
So let's say I want to predict the risk of cardiovascular disease given a patient's height and weight.
This is a categorical problem because my prediction is either going to be at risk or not at risk.
Again, this comes down to a data collection experiment.
I'm going to look at all my hospital records and I'm going to write down all of this information in
an Excel spreadsheet.
I'll have two columns to represent my ex and one column to represent my target.
Why, by the way, not that it's customary to represent binary targets as the integers zero and one.
So he would say not at risk is zero.
And at risk is one note that there's no reason that at risk should be one.
Just like the dogs and cats example.
It doesn't matter of dogs are one and cats are zero or dogs or zero and cats are one.
This assignment is just arbitrary.
OK, so now that I've collected all my data, what am I going to do?
Well, again, I'm going to apply these on a grid, on the horizontal axis.
I'm going to have my first feature, the patient's height on the vertical axis.
I'm going to have my second feature, the patient's weight.
Now, importantly, unlike regression, the target does not get its own axis instead because it's categorical
we would represent it with color.
So I might color the at risk patients as blue and the not at risk patients as green.
OK, so what is my model going to be for classification?
Well, the simplest model, again, is a line.
However, this line is a little bit different from our regression line from earlier.
The regression line, if you recall, was the line of best fit.
We are trying to get the line to be close to all the data points.
Now, we are no longer trying to do that.
Instead, we are trying to get the line to separate the two groups of data points or in other words,
separate the different colors.
As you can see, this, again, boils down to a geometry problem, how do we find this line that can
indeed separate these categories?
One lesson that goes hand-in-hand with the geometrical perspective is another motto of mine, all data
is the same.
Let's use another example to illustrate the point.
Suppose instead of working at a hospital, you now work at an insurance company, your job is to do
fraud detection or in other words, classify instances of fraud.
So again, you have two categories.
Fraud or not fraud.
You're trying to predict whether or not a given claim is fraud, let's say, again, you've collected
some data points again with two input figures.
Suppose these are, number one, the amount of debt the claimant has.
And number two, the total amount of past insurance claims.
And again, it's the same story once you've collected all your data points, you're going to plot them
and color them on a grid.
Your job, again, is to separate these data points with a line or a curve.
So you see that just because we change the meaning of the problem, we haven't changed what our actual
task is.
It's still to plot these points and separate them with some kind of decision boundary.
A line is the simplest, but just like with regression, there are two ways we can make this more complicated.
The first way is that we can have more input features so that it's not possible to plot them on a grid
that we can visualize.
The second way is that the decision boundary may not be linear, in which case the model will be an
equation that's more complicated than a line or hyper plane.
Importantly, however, the moral of the story remains the same.
This is still a geometry problem.
And in fact, for our two classification examples, the geometry problem was the same, the only thing
that changed was the meaning of the numbers.
Of course, machine learning algorithms don't care about these meanings.
And so they are essentially irrelevant in the eyes of the machine learning model.
That's why we say all data is the same.
This becomes a very powerful concept in the future.
For example, the same kind of model used for neural machine translation can also be used for a chappe.
The same kind of model used for sentiment analysis can also be used for spam detection.
Thinking in this way essentially gives you machine learning superpowers.
To summarize this lecture, the goal was to take the magic away from machine learning.
You learned a very important lesson, which is that machine learning is magic.
In fact, it's just geometry.
We learned about the two different kinds of geometry problems that supervised learning can solve.
The first kind is regression, where we try to get a line of plain hydroplane or curve to be as close
as possible to the data points from a given data set.
The second kind is classification, where instead of trying to get the curve as close as possible to
the data points, we try to separate data points belonging to different categories.
One important lesson that goes along with this is that all data is the same, it doesn't matter if we're
trying to classify risk of cardiovascular disease or if we're trying to classify fraud in an insurance
company, the general problem remains the same.
And it is a problem of geometry.