From e46409e85367f7db8834d76563fa931cdb1cb048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rapa=C5=88?= <71029912+davidrapan@users.noreply.github.com> Date: Wed, 30 Sep 2020 16:00:53 +0200 Subject: [PATCH] Update ConfusionMatrix.cs Fix for less than two distinct in expected values. --- .../Accord.Statistics/Analysis/Performance/ConfusionMatrix.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 " +