In this lecture we are going to answer the question what is machine learning.
I always like to discuss this first because they 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 here's 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 adjusts 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 motto 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 geometry geometry is just lines planes curves circles
and so forth.
That's why you'll sometimes hear grumpy old statisticians say things like machine learning is nothing
but 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 is 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 B.
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 are 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 1 up to x n and y one up to why n.
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 an index by the numbers 1 to N 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 record things like what kind of degree the person has like a bachelors masters
or PGD.
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 two 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 nonlinear.
Think of something simple like exercise.
If I do 20 pushups Well 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 are 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 X and one column to represent my target y by the way.
Note that it's customary to represent binary targets as the integers 0 and 1.
So he would say not at risk is zero and at risk is 1.
Note that there is no reason that at risk should be one.
Just like the dogs and cats example it doesn't matter of dogs or 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 then not at risk patients as green.
So what is my model going to be for classification.
Well the simplest model again is a lie.
However this line is a little bit different from our regression line from earlier.
The regression line if you would call 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 model of mind.
All data is the same.
Let's use another example to illustrate the point suppose instead of working at a hospital you now work
and 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 features.
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 plain.
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 meetings 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 chapter
of the same kind of model used for sentiment analysis can also be used for spam detection in 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 a 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 and playing hydroplaning or curve to be as close
as possible to the data points from a given dataset.
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.