Skip to content

Commit

Permalink
Fix output of linearRegCostFunction
Browse files Browse the repository at this point in the history
  • Loading branch information
jtlowery committed Apr 14, 2017
1 parent e43df16 commit 30262a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ex5/ex5.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
# regression.

theta = np.array([1, 1])
J = linearRegCostFunction(np.column_stack((np.ones(m), X)), y, theta, Lambda=1)[0]
J, _ = linearRegCostFunction(np.column_stack((np.ones(m), X)), y, theta, Lambda=1)

print('Cost at theta = [1 1]: %f \n(this value should be about 303.993192)\n' % J)

Expand Down
2 changes: 2 additions & 0 deletions ex5/linearRegCostFunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ def linearRegCostFunction(X, y, theta, Lambda):
"""
# Initialize some useful values
m = y.size # number of training examples
J = 0.0
grad = 0.0

# ====================== YOUR CODE HERE ===================================
# Instructions: Compute the cost and gradient of regularized linear
Expand Down

0 comments on commit 30262a8

Please sign in to comment.