Why it shoud be floating point

in this equation, given theta as floating point. Why giving as floating point while visualizing gradient descent to visualize the slope converging to zero?
theta = np.array([-2.0,0.0])

actually 2.0 is equals to 2. what is the difference in float and integer while ploting graph

You can keep 2 but you have specify dtype of the array as float32.

theta = np.array([-2.0,0.0],dtype=‘float32’)
when you update theta using gradient descent update, the values you get are floating point numbers.

If the theta array is initiated as an integer then it will not get converted into float while it is being updated in gradient descent. And there would only be a rare case where all your parameters will have all integral values.

Now if you observe cell number 88 - 91
Array is not updated because the dtype of arr is int

But if you convert the array to float (just like in cell number - 92), you will see the values are updated in the arr and not rounded of.

So in case of linear regression, if all theta values/parameters are kept integer then you would never have a accurate hypothesis for your model.

1 Like

Hi Rinshan, as you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.

Please mark your doubts as resolved in your course’s “ Ask Doubt ” section, when your doubt is resolved.

I am sorry. I didn’t see . You can close