#Useful linearspaces to give values to the parameters w and b
w = np.linspace(-20, 20, 100)
b = np.linspace(-20, 20, 100)
#Get the z value for a bowl-shaped cost function
z=np.zeros((len(w), len(b)))
j=0
for x in w:
i=0
for y in b:
z[i,j] = x**2 + y**2
i+=1
j+=1
#Create the 3D surface plot of the bowl-shaped cost function
ax.plot_surface(W, B, z, cmap = "Spectral_r", alpha=0.7, antialiased=False)
ax.plot_wireframe(W, B, z, color='k', alpha=0.1)
In the above code blocks in soup_bowl function, why are calculating cost this way while the definition is (f(w, b)-y)**2)/2*m.
Thanks @TMosh. I get that.
Given that we are iterating with (x in w) and (y in b), for a particular tuple x^2 + y^2 is of the form w^2 + b^2.
However, my question is how is (f(w,b)-y)^2) i.e. (((wx+b)-y)^2) = x^2 + y^2 ?