From e57f444e216e4bf4910f96bea3fe057e3f33e773 Mon Sep 17 00:00:00 2001 From: Jincheng9 Date: Sun, 23 Mar 2014 20:29:12 +0800 Subject: [PATCH 1/4] let cnntest return the predicted label --- CNN/cnntest.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CNN/cnntest.m b/CNN/cnntest.m index 64ba271..1648fd6 100644 --- a/CNN/cnntest.m +++ b/CNN/cnntest.m @@ -1,9 +1,9 @@ -function [er, bad] = cnntest(net, x, y) +function [predicted_label, er, bad] = cnntest(net, x, y) % feedforward net = cnnff(net, x); - [~, h] = max(net.o); + [~, predicted_label] = max(net.o); [~, a] = max(y); - bad = find(h ~= a); + bad = find(predicted_label ~= a); er = numel(bad) / size(y, 2); end From 5774d4e0d8f96696ec72f635e41a3f02ecccb90b Mon Sep 17 00:00:00 2001 From: Jincheng9 Date: Sun, 23 Mar 2014 20:30:52 +0800 Subject: [PATCH 2/4] update cnntest --- tests/test_example_CNN.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_example_CNN.m b/tests/test_example_CNN.m index 05ce9d9..b502ae3 100644 --- a/tests/test_example_CNN.m +++ b/tests/test_example_CNN.m @@ -28,7 +28,7 @@ cnn = cnnsetup(cnn, train_x, train_y); cnn = cnntrain(cnn, train_x, train_y, opts); -[er, bad] = cnntest(cnn, test_x, test_y); +[predicted_label, er, bad] = cnntest(cnn, test_x, test_y); %plot mean squared error figure; plot(cnn.rL); From a000de45110fbcb286f3699c571e74ac249f32c9 Mon Sep 17 00:00:00 2001 From: Jincheng9 Date: Sun, 23 Mar 2014 20:32:42 +0800 Subject: [PATCH 3/4] update cnntest --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index be277e4..94be00e 100644 --- a/README.md +++ b/README.md @@ -180,7 +180,7 @@ opts.numepochs = 1; cnn = cnntrain(cnn, train_x, train_y, opts); -[er, bad] = cnntest(cnn, test_x, test_y); +[predicted_label, er, bad] = cnntest(cnn, test_x, test_y); %plot mean squared error figure; plot(cnn.rL); From 52b831d9074495a7cce95d36a38711ed28079b38 Mon Sep 17 00:00:00 2001 From: Jincheng9 Date: Mon, 24 Mar 2014 14:21:32 +0800 Subject: [PATCH 4/4] fix the bugs of cnntest --- CNN/cnntest.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CNN/cnntest.m b/CNN/cnntest.m index 1648fd6..5726b28 100644 --- a/CNN/cnntest.m +++ b/CNN/cnntest.m @@ -1,9 +1,9 @@ function [predicted_label, er, bad] = cnntest(net, x, y) % feedforward net = cnnff(net, x); - [~, predicted_label] = max(net.o); + [~, h] = max(net.o); [~, a] = max(y); - bad = find(predicted_label ~= a); - + bad = find(h ~= a); + predicted_label = h-1; er = numel(bad) / size(y, 2); end