Hello my friends.
Congratulations again for completing part one Data preprocessing.
You are now ready to build machine learning models
and the first models that we're going to build together are regression models.
Welcome to part two on regression.
This is the branch of machine learning that aims
to predict some continuous real numbers, like for example,
a salary or a temperature or any kind of continuous numerical value.
And together we will build the best models to make these predictions.
And so now first of all, let's make sure we are all on the same page.
This is the whole machine learning A to z folder
containing all the codes in Python and R and the data set.
I gave you the link of this folder right before this tutorial.
You know in the article to make sure to connect to this folder.
And also make sure to download the whole folder
in order to get the data sets, because we will have indeed to import them
whenever we build a machine learning model.
All right.
And so now, since we're all on the same page, let's start
our new journey within regression part two regression.
There we go.
There are several sections inside each section
corresponding to a different regression model.
We're going to start with simple linear regression,
which is the simplest machine learning model you could ever build.
And so it's good that we start with this, because indeed with this one
we will only have one independent variable.
You know, one feature and of course one continuous real value to predict.
Then we will move on to multiple linear regression,
which is based on the same equation than simple linear regression.
Only this time we will have several features instead of one.
Then we will move on to polynomial regression,
which will allow us to tackle some non-linear data sets.
You know, data sets with non-linear correlations as opposed to previous
models, simple linear regression and multiple linear regression,
which can provide some amazing and accurate predictions for linear data set.
You know, data sets with linear correlations.
Then after polynomial regression, we will move on to support
vector regression, which is another kind of non-linear model
that can make some accurate predictions
for non-linear data sets with non-linear correlations.
And then finally we will move on to decision tree regression
and random forest regression, which can provide an alternative
to predict an outcome for non-linear data sets.
So you will have many options.
You know, after this part two,
you will have basically a toolkit of several regression models.
And so whenever you end up with a new data set where you have to predict
a real continuous outcome, well, you can just try all of them
and select in the end the one that has the best accuracy.
And thanks to the code templates that will result
from each of these sections, you know you will get very clear code
templates that you can adapt to your own data sets so that you can try
these models on your own data sets in a flashlight quickly and efficiently,
so that you can select the best one, giving you the best accuracy.
And so now in this first section
in regression, we're going to start with simple linear regression of course.
So there we go.
Make sure to go inside this folder.
We're going to start with Python.
So let's go inside this Python folder and you will find inside two files.
First the data set salary data dot CSV.
And of course our Python implementation which has the IPython notebook format
which I remind you can run on either Google Colab or Jupyter Notebook.
And of course we're going to implement this model together on Google Colab.
But first let me explain the data set and the problem
that we're going to solve with simple linear regression.
And to do this, I'm going to open our data
set here and explain what this is about.
All right.
So first I want to reassure you that indeed this is a very simple data set.
You know, with only 30 observations.
And of course in real life the data sets are more complex.
But I want to start working on a simple data set
so that we can really focus on how to build the model itself.
You know, because if we had a complex data set,
we would lose a bit our focus on the model.
And I really want us to focus on the model.
So let me describe the data set.
It is a data set containing, as you can see,
30 observations and two columns with of course one feature.
This is the feature years of experience and the dependent variable
which we want to predict which is the salary.
So let's say that this data set belongs to a company that gathered
data of some of their employees, collecting for each of them,
their years of experience and their salary.
So you see, each row of the data set here corresponds to different employees,
corresponds to one employee of the company,
and for each employee of this company, we have indeed the number of years
of experience in the company and their salary.
Okay.
And so the goal very simply is to build a simple linear regression model
that will be trained to understand the correlations
between the number of years of experience and the salary,
so that it can predict for a new employee, you know, having a new number
of years of experience.
Well, the corresponding salary or the salary that this person should get.
So you see, that's a very easy problem.
But at least you'll know how to build a simple linear
regression model and perfectly master it in all the detail.
And then I want to say something very important.
Remember that we're going to build each time
some code templates which you can adapt to your own data set,
so that when you want to use the code template on your own data set,
you will only have one thing to change, which will be the name of your data.
I will always make sure to make the code templates as much generic as we can,
so that you only have 1 or 2 things to change when you want to deploy them
on your data set.