Question: TODO: implement the cost function The squared error cost function is 12=1((())())2=12=1(0+1()())2.12i=1m(h(x(i))y(i))2=12i=1m(0+1x(i)y(i))2. *Note: the superscript of i represents the iteration number, not the expontent. Open
TODO: implement the cost function
The squared error cost function is
12=1((())())2=12=1(0+1()())2.12i=1m(h(x(i))y(i))2=12i=1m(0+1x(i)y(i))2.
*Note: the superscript of i represents the iteration number, not the expontent.
Open the file gd.py and implement cost_function. Then run this cell to test it out.
In [ ]:
print(cost_function(x, y, 0, 1)) # should print 104.772951994
print(cost_function(x, y, 2, -1)) # should print 744.953822077
print(cost_function(x, y, -1, 2)) # should print 14.090816198
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
