WEBVTT

00:00.080 --> 00:01.040
Welcome back.

00:01.040 --> 00:07.920
Now let's start with the first step which is preparing the data set for our model.

00:07.960 --> 00:14.680
Open Google Colab using Colab Google URL and click Open Colab.

00:14.840 --> 00:17.000
Go to upload browse.

00:17.200 --> 00:23.480
And here we have inside this folder using TensorFlow.

00:23.800 --> 00:25.520
This is the file that we need.

00:25.520 --> 00:27.960
Number six click open.

00:28.120 --> 00:35.280
And by the way all those files are available in the resources folder under each section.

00:35.280 --> 00:40.960
Or you can download them from the resources folder inside the first section.

00:40.960 --> 00:50.440
So here we have this file I want from you to follow me step by step linear regression with TensorFlow.

00:50.440 --> 01:02.680
In the previous videos and in the previous notebooks, we used the sky learn NumPy, pandas, and matplotlib

01:02.680 --> 01:03.480
libraries.

01:03.520 --> 01:10.500
Now we're going to use some of those libraries, but we're going to introduce the TensorFlow library

01:10.500 --> 01:11.860
in this model.

01:11.860 --> 01:22.580
In the previous videos we get um, an equation a learned equation saying that price equals to 2.9 times

01:22.620 --> 01:24.660
size plus 2.7.

01:24.980 --> 01:29.020
This is the final conclusion from the previous model.

01:29.300 --> 01:36.420
If you if you remember now we're going to start with with TensorFlow from zero.

01:36.540 --> 01:40.540
We're going to not tell him this this equation.

01:40.540 --> 01:44.500
We need to see the and get to this equation.

01:44.500 --> 01:49.780
We need to conclude this equation as a final result okay.

01:49.820 --> 01:54.300
So let's start building our model with TensorFlow.

01:54.420 --> 01:59.300
The first step we need to do is to install TensorFlow.

01:59.580 --> 02:05.660
So here let's start with pip install TensorFlow.

02:05.860 --> 02:13.000
If you are using Ides like a PyCharm, Jupyter or others.

02:13.000 --> 02:18.040
You need to use pip install TensorFlow and not the exclamation mark.

02:18.080 --> 02:25.760
Let me run here we are using the Python package installer to install TensorFlow and here we go.

02:25.920 --> 02:33.760
By the way, those libraries are already installed because a requirement already satisfied by Google

02:33.760 --> 02:34.640
Colab.

02:34.640 --> 02:37.720
So there is no need to execute this step.

02:37.720 --> 02:45.480
But I'm showing you if you are using the pre the Ides on your computer like pie chart.

02:45.640 --> 02:48.240
Okay, so I'll clear the output.

02:48.240 --> 02:49.680
This is the first step.

02:49.920 --> 02:51.720
This is the second step.

02:51.720 --> 02:58.640
Installing TensorFlow by using import TensorFlow as tf.

02:59.200 --> 03:02.840
And we need to print the TensorFlow version.

03:02.840 --> 03:08.040
Let me run and here we go TensorFlow version is 2.9.

03:08.240 --> 03:16.820
Always use the TF dot version or any library version to check the version and to check if the library

03:16.820 --> 03:20.300
is already installed correctly or not.

03:20.420 --> 03:25.500
The second step is generating random data.

03:25.500 --> 03:30.900
So here installing TensorFlow and here generating random data.

03:30.940 --> 03:40.420
Let me start by importing some libraries that we are going to use numpy as np, import pandas as pd

03:40.900 --> 03:44.540
and import matplotlib.pyplot as plt.

03:44.780 --> 03:52.740
And as we did in the previous videos, we need to set random seeds for reproducibility.

03:52.740 --> 04:01.820
So NP random seed 42 and tf which is TensorFlow random seed 42.

04:01.860 --> 04:12.020
Anytime you call numpy random function like NP random dot rand or NP random dot shuffle, etc., you'll

04:12.020 --> 04:20.970
get the same random results and you will set the same number each run as long as the seed is fixed.

04:21.010 --> 04:23.130
Let me show you an example here.

04:23.170 --> 04:27.370
Print NP dot random dot rand.

04:27.610 --> 04:30.450
And here I need to pass number three.

04:30.690 --> 04:32.370
So let me run.

04:32.410 --> 04:32.930
Okay.

04:33.210 --> 04:34.490
Those are the numbers.

04:34.490 --> 04:35.890
Let me run again.

04:35.930 --> 04:37.450
Again and again.

04:37.650 --> 04:41.730
So every time you run this you get the same results.

04:41.770 --> 04:51.890
So those results would be and those functions are going to be used for generating random numbers.

04:51.890 --> 04:57.370
But then we're going to fix them and we're going to use them each time.

04:57.370 --> 05:01.730
So every time we run the application we'll get the same results.

05:01.770 --> 05:02.210
Okay.

05:02.250 --> 05:11.890
So those are used for getting the same results, the same random numbers each run as long as the seed

05:11.890 --> 05:12.650
is fixed.

05:12.770 --> 05:22.390
TensorFlow tf dot random dot set seed TensorFlow also has its own random number generator independent

05:22.390 --> 05:23.390
from numpy.

05:23.750 --> 05:33.190
This sets the seed for TensorFlow's random operation like random dot uniform or random dot normal random

05:33.190 --> 05:37.390
initialization of weights in neural networks.

05:37.430 --> 05:46.750
Okay, so if your project uses both NumPy and TensorFlow, setting seeds in both ensures your entire

05:46.750 --> 05:49.270
pipeline is reproducible.

05:49.270 --> 05:56.710
Data shuffling, weight initialization, and etc. etc. without this, every run might produce slightly

05:56.710 --> 06:01.070
different results, making debugging and comparison harder.

06:01.310 --> 06:04.990
Okay, so in short np.random.seed.

06:04.990 --> 06:15.510
And this is for controlling randomness from and py and this will control the randomness from TensorFlow.
