Skip to content

Commit

Permalink
minor tweak logistic regression
Browse files Browse the repository at this point in the history
  • Loading branch information
sth4nth committed Mar 9, 2017
1 parent 5074a11 commit 9e70e29
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion chapter04/logitBinPred.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
% Written by Mo Chen ([email protected]).
X = [X;ones(1,size(X,2))];
w = model.w;
p = exp(-log1pexp(-w'*X));
p = sigmoid(w'*X);
y = round(p);

3 changes: 1 addition & 2 deletions chapter04/logitMnPred.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
% Written by Mo Chen ([email protected]).
W = model.W;
X = [X; ones(1,size(X,2))];
A = W'*X;
P = exp(bsxfun(@minus,A,logsumexp(A,1)));
P = softmax(W'*X);
[~, y] = max(P,[],1);

0 comments on commit 9e70e29

Please sign in to comment.