diff --git a/Sources/Accord.Statistics/Analysis/Performance/ConfusionMatrix.cs b/Sources/Accord.Statistics/Analysis/Performance/ConfusionMatrix.cs index 5ae7998a1..3c61f60d8 100644 --- a/Sources/Accord.Statistics/Analysis/Performance/ConfusionMatrix.cs +++ b/Sources/Accord.Statistics/Analysis/Performance/ConfusionMatrix.cs @@ -183,8 +183,7 @@ public ConfusionMatrix(bool[] predicted, bool[] expected) /// public ConfusionMatrix(int[] predicted, int[] expected) { - int[] expectedSymbols = expected.Distinct(); - if (expectedSymbols.Length != 2) + if (expected.DistinctCount() > 2) { throw new Exception("The vector of expected values contains more than two possible symbols. Please make sure the " + "expected vector contains only values 0 or 1, or -1 and +1. If you have a multi-class decision problem, please " +