Skip to content

Commit

Permalink
CompactClassificationDiscriminant: change data set in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pr0m1th3as committed Aug 27, 2024
1 parent 48e633c commit 766029a
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions inst/Classification/CompactClassificationDiscriminant.m
Original file line number Diff line number Diff line change
Expand Up @@ -718,19 +718,19 @@ function savemodel (this, fname)

## Test predict method
%!test
%! x = [1, 2, 3; 4, 5, 6; 7, 8, 9; 3, 2, 1];
%! y = {"a"; "a"; "b"; "b"};
%! Mdl = fitcdiscr (x, y, "Gamma", 0.5);
%! load fisheriris
%! x = meas;
%! y = species;
%! Mdl = fitcdiscr (meas, species, "Gamma", 0.5);
%! CMdl = compact (Mdl);
%! [label, score, cost] = predict (CMdl, x);
%! l = {'a'; 'a'; 'b'; 'b'};
%! s = [0.7642, 0.2358; 0.5011, 0.4989; ...
%! 0.2375, 0.7625; 0.4966, 0.5034];
%! c = [0.2358, 0.7642; 0.4989, 0.5011; ...
%! 0.7625, 0.2375; 0.5034, 0.4966];
%! assert (label, l)
%! assert (score, s, 1e-4)
%! assert (cost, c, 1e-4)
%! [label, score, cost] = predict (CMdl, [2, 2, 2, 2]);
%! assert (label, {'versicolor'})
%! assert (score, [0, 0.9999, 0.0001], 1e-4)
%! assert (cost, [1, 0.0001, 0.9999], 1e-4)
%! [label, score, cost] = predict (CMdl, [2.5, 2.5, 2.5, 2.5]);
%! assert (label, {'versicolor'})
%! assert (score, [0, 0.6368, 0.3632], 1e-4)
%! assert (cost, [1, 0.3632, 0.6368], 1e-4)
%!test
%! load fisheriris
%! x = meas;
Expand Down

0 comments on commit 766029a

Please sign in to comment.