From 19642dd1a4a4854be856a0db79204aee9dfa106e Mon Sep 17 00:00:00 2001 From: MD KAISH ANSARI <32337116+kaish114@users.noreply.github.com> Date: Sun, 27 Jan 2019 02:00:54 +0530 Subject: [PATCH] predictOneVsAll updated previous solution was wrong --- .../Week 04/ex3/predictOneVsAll.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Andrew Ng Stanford Coursera/Week 04/ex3/predictOneVsAll.m b/Andrew Ng Stanford Coursera/Week 04/ex3/predictOneVsAll.m index 2c85556..68b83e4 100644 --- a/Andrew Ng Stanford Coursera/Week 04/ex3/predictOneVsAll.m +++ b/Andrew Ng Stanford Coursera/Week 04/ex3/predictOneVsAll.m @@ -32,8 +32,15 @@ % temp = (X*all_theta'); % p(:) = max(temp,[],2); -h_theta = (X * all_theta'); -p = max(h_theta, [], 2); +%h_theta = (X * all_theta'); +%p = max(h_theta, [], 2); + + pro = X * all_theta'; + % m * num_labels + kind = max(pro, [], 2); + for i = 1: m + p(i) = find(pro(i,:) == kind(i)); +end % temp is of dimension 5000x10