Skip to content

Commit

Permalink
working on ex2
Browse files Browse the repository at this point in the history
  • Loading branch information
bhrgv-bolla committed May 16, 2018
1 parent 5b7a5bc commit 13a1183
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Binary file modified ML/machine-learning-ex2/ex2.pdf
Binary file not shown.
5 changes: 2 additions & 3 deletions ML/machine-learning-ex2/ex2/costFunction.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@
%x => 100*3
%theta => 3*1
%output => 100*1
theta
hypothesisBeforeSigmoid = X * theta;
hypothesis = sigmoid(hypothesisBeforeSigmoid); % Theta transpose * x
falseNegatives = (1.-y)' * log(1-hypothesis)
falsePositives = y' * log(hypothesis)
falseNegatives = (1.-y)' * log(1-hypothesis);
falsePositives = y' * log(hypothesis);

costPartial = - (falsePositives + falseNegatives);
J = costPartial ./ m;
Expand Down
5 changes: 4 additions & 1 deletion ML/machine-learning-ex2/ex2/predict.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
% You should set p to a vector of 0's and 1's
%


innerValue = X * theta;
hypothesis = sigmoid(innerValue);
inference = @(x) (x>=0.5) * 1 + (x<0.5) * 0;
p = inference(hypothesis);



Expand Down
2 changes: 1 addition & 1 deletion ML/machine-learning-ex2/ex2/token.mat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Created by Octave 3.8.0, Wed May 16 15:36:00 2018 PDT <bbolla@m-c02w20n1htdg>
# Created by Octave 3.8.0, Wed May 16 15:44:00 2018 PDT <bbolla@m-c02w20n1htdg>
# name: email
# type: sq_string
# elements: 1
Expand Down

0 comments on commit 13a1183

Please sign in to comment.