diff --git a/ex3/test_ex3.m b/ex3/test_ex3.m index 3cf2148..d1003fd 100644 --- a/ex3/test_ex3.m +++ b/ex3/test_ex3.m @@ -10,3 +10,5 @@ %!test test_oneVsAll() %!test test_predictOneVsAll() + +%!test test_predict() diff --git a/ex3/test_predict.m b/ex3/test_predict.m new file mode 100644 index 0000000..fea6547 --- /dev/null +++ b/ex3/test_predict.m @@ -0,0 +1,19 @@ +function test_predict() + + %c = predict(Theta1, Theta2, X); + c = predict(ones(3, 8), ones(1, 4), ones(9, 7)); + assert(c, ones(9, 1)); + + c = predict(ones(3, 8), ones(1, 4), magic(7)); + assert(c, ones(7, 1)); + + c = predict(-1/170*ones(3, 8), -1/3*ones(1, 4), magic(7)); + assert(c, ones(7, 1)); + + predict(-1/170*ones(3, 8), -1/3*ones(2, 4), magic(7)); + assert(c, ones(7, 1)); + + predict(-1/170*ones(3, 8), -1/3*ones(3, 4), magic(7)); + assert(c, ones(7, 1)); + +endfunction