Welcome back.
We imported NumPy, pandas, and matplotlib libraries, and we used numpy and TensorFlow random seeds,
setting them to 42.
And here we are controlling the randomness from numpy.
And here we are controlling randomness from TensorFlow.
Now let's generate the same random data.
So here random data size equals to two times NP dot random dot random from 101 plus one, and the price
three times size plus two plus MP random times 0.5.
This is what we've done in the previous notebooks, but don't worry, I'll clarify everything.
Let me start with the size.
At first we are generating 100 rows times one column array of random numbers between 0 and 1.
So np.random.rand.
Here we are generating one array that contains 100 rows With one colon.
For example, this is the generated array 0.30.950.73, and so on multiplies all values by two.
So this size times two all values will be multiplied by two.
The range becomes from 0 to 2.
It was 0 to 1.
The range between 0 and 1.
Now the range becomes 0 to 2.
Then we added one to make the range becomes 1 to 3, representing 1000 to 3000ft² houses.
So the size of houses would range from 1000 to 3000ft² houses.
Now let's move to the prices.
So here we are creating a true linear relationship.
As we learned before in mathematics we have a linear equation y equals w x plus b w or a.
We can replace it by a ax plus b or w x plus b a is the slope.
X is the variable and b is the coefficient or the intercept.
The slope a which here represents number three.
The slope equals to three.
For every 1000ft² increase, price increased by $3,000.
Intercept equals to two.
So B equals to two.
Here base price of $2,000 and NP dot random dot random and 100 to 1.
This generates random numbers from a standard normal distribution mean equal to zero and standard deviation
equals to one.
I'm not gonna make it, uh, complicated and complex.
I just want from you to understand that here we are generating random numbers based on size and price.
And the linear equation is based on the price.
So y equals to three times x plus two plus MP random.
And this is the coefficient b.
Run the cell and here we go.
We get the size and the price okay.