-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84c6df2
commit 9046a73
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
|
||
%!test test_costfunction_nontrivial() | ||
|
||
% !test test_gradient() | ||
%!test test_predict() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
function test_predict () | ||
|
||
X = [0 0; | ||
0 1; | ||
1 0; | ||
1 1]; | ||
|
||
% all these should pass | ||
assert(predict([1 1]', X), logical([1 1 1 1]')); | ||
assert(predict([0 0]', X), logical([1 1 1 1]')); | ||
|
||
% fail ... according to some math... | ||
assert(predict([-1 -1]', X), logical([1 0 0 0]')); | ||
assert(predict([-1 0]', X), logical([1 1 0 0]')); | ||
assert(predict([0 -1]', X), logical([1 0 1 0]')); | ||
assert(predict([-1 -1]', X), logical([1 0 0 0]')); | ||
|
||
% fail or pass ... based on the same math as above (which | ||
% is intentionally not shared) | ||
assert(predict([1.1 -1]', X), logical([1 0 1 1]')); | ||
assert(predict([-1 1.1]', X), logical([1 1 0 1]')); | ||
|
||
endfunction |