Welcome back.
Now let's start with the first step which is preparing the data set for our model.
Open Google Colab using Colab Google URL and click Open Colab.
Go to upload browse.
And here we have inside this folder using TensorFlow.
This is the file that we need.
Number six click open.
And by the way all those files are available in the resources folder under each section.
Or you can download them from the resources folder inside the first section.
So here we have this file I want from you to follow me step by step linear regression with TensorFlow.
In the previous videos and in the previous notebooks, we used the sky learn NumPy, pandas, and matplotlib
libraries.
Now we're going to use some of those libraries, but we're going to introduce the TensorFlow library
in this model.
In the previous videos we get um, an equation a learned equation saying that price equals to 2.9 times
size plus 2.7.
This is the final conclusion from the previous model.
If you if you remember now we're going to start with with TensorFlow from zero.
We're going to not tell him this this equation.
We need to see the and get to this equation.
We need to conclude this equation as a final result okay.
So let's start building our model with TensorFlow.
The first step we need to do is to install TensorFlow.
So here let's start with pip install TensorFlow.
If you are using Ides like a PyCharm, Jupyter or others.
You need to use pip install TensorFlow and not the exclamation mark.
Let me run here we are using the Python package installer to install TensorFlow and here we go.
By the way, those libraries are already installed because a requirement already satisfied by Google
Colab.
So there is no need to execute this step.
But I'm showing you if you are using the pre the Ides on your computer like pie chart.
Okay, so I'll clear the output.
This is the first step.
This is the second step.
Installing TensorFlow by using import TensorFlow as tf.
And we need to print the TensorFlow version.
Let me run and here we go TensorFlow version is 2.9.
Always use the TF dot version or any library version to check the version and to check if the library
is already installed correctly or not.
The second step is generating random data.
So here installing TensorFlow and here generating random data.
Let me start by importing some libraries that we are going to use numpy as np, import pandas as pd
and import matplotlib.pyplot as plt.
And as we did in the previous videos, we need to set random seeds for reproducibility.
So NP random seed 42 and tf which is TensorFlow random seed 42.
Anytime you call numpy random function like NP random dot rand or NP random dot shuffle, etc., you'll
get the same random results and you will set the same number each run as long as the seed is fixed.
Let me show you an example here.
Print NP dot random dot rand.
And here I need to pass number three.
So let me run.
Okay.
Those are the numbers.
Let me run again.
Again and again.
So every time you run this you get the same results.
So those results would be and those functions are going to be used for generating random numbers.
But then we're going to fix them and we're going to use them each time.
So every time we run the application we'll get the same results.
Okay.
So those are used for getting the same results, the same random numbers each run as long as the seed
is fixed.
TensorFlow tf dot random dot set seed TensorFlow also has its own random number generator independent
from numpy.
This sets the seed for TensorFlow's random operation like random dot uniform or random dot normal random
initialization of weights in neural networks.
Okay, so if your project uses both NumPy and TensorFlow, setting seeds in both ensures your entire
pipeline is reproducible.
Data shuffling, weight initialization, and etc. etc. without this, every run might produce slightly
different results, making debugging and comparison harder.
Okay, so in short np.random.seed.
And this is for controlling randomness from and py and this will control the randomness from TensorFlow.