Skip to content

Commit

Permalink
Used predict function
Browse files Browse the repository at this point in the history
  • Loading branch information
jtlowery committed Mar 14, 2017
1 parent d455d55 commit 0dd7a31
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ex2/ex2_reg.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from costFunctionReg import costFunctionReg
from gradientFunctionReg import gradientFunctionReg
from sigmoid import sigmoid
from predict import predict


def optimize(Lambda):
Expand Down Expand Up @@ -97,14 +98,14 @@ def plotBoundary(theta, X, y):
plotBoundary(theta, X, y)

# Compute accuracy on our training set
p = np.round(sigmoid(X.dot(theta)))
acc = np.mean(np.where(p == y.T, 1, 0)) * 100
p = predict(theta, X)
acc = np.mean(np.where(p == y, 1, 0)) * 100
print('Train Accuracy: %f' % acc)

input('Program paused. Press Enter to continue...')

# ============= Part 3: Optional Exercises =============

# ============= Part 3: Optional Exercises =============

for Lambda in np.arange(0.0, 10.1, 1.0):
result = optimize(Lambda)
Expand Down

0 comments on commit 0dd7a31

Please sign in to comment.