Welcome back.
Now scroll down.
We have a data set simulated house prices.
We're going to create a simple data set where the size in square feet which is a feature on x axis,
and the price in thousands, which is the target on y axis.
Did you remember the feature and the target terminology?
Please go back to the previous lessons and in the in the ML introduction section for more information.
This is a supervised regression problem.
Supervised means predicting a continuous numerical value based on past examples where we know both the
inputs and correct outputs.
Okay, let me scroll down here.
We have NP dot random dot seed 42.
Here.
The first step we're going to set the random seed for reproducibility means every time you run the code
you'll get the same random numbers.
Okay, so here we are getting the same random numbers every time we run the cell.
Then we have size equals to two times NP dot random dot random from 101 plus one.
This is used for generating 100 random numbers 100 rows and one column.
So let me explain everything.
100 rows and one column.
Okay.
It's very simple.
The third line is price equals to three times size plus two plus NP random times 0.5.
This is a linear relationship three times size plus two.
This is a linear linear relationship between size and price.
So the price depends on size to be productive.
For example, if the size is equals to two three times two six plus two, the price would be eight.
So as the size increased, the price increase multiplied by 0.5 for the random numbers.
This, the NP random number generates random noise from a normal distribution with mean equal to zero,
and standard deviation equals to one times 0.5.
Reduces noise level.
Adding noise makes the data looks more realistic, not perfectly linear.
Okay, this is a simple mathematical things.
In order to get and make our data looks more realistic.
In short, this code simulates a data set where price depends on size in a roughly linear way with some
random noise added.
Okay, now let me explain the data visualization using and the data frame.
Here we have PD which is Panda Pandas library dot data frame.
We talked about the data frame in the previous videos, and inside it we have MP concatenate and the
columns the MP concatenate.
The size shape 101 the shape.
The price is a shape 100 to 1 which is there the range and NP concatenate joins the columns side by
side column wise.
Okay, and the result would be a shape.
Each row has a size and price array.
Then we have the PD dot data frame.
We talked about it.
This converts the numpy array into a pandas data frame.
Let.
Let me put this note here.
So did you remember pandas?
This is used for table like structure visualization.
Also we have the two columns the size and the price.
The size in square meters in thousands of square square feet.
And the price would be in thousand dollars.
Okay then we used to print the first ten results.
Let me run and here we go.
This is a random data generated using the random MP random.
The numpy.
We use the random number generation using the numpy.
Also we have.
We have the size and the price size is depending on random numbers plus one shifting.
And the price depends on size times three plus two plus this random number times 0.5.
Okay.
So this is the linear relationship between the columns and the rows and x and y axes.
This is the size in square feet.
For example the first house is
1749ft².
The price is $7,290.