- Timestamp:
- 10/29/15 20:39:11 (9 years ago)
- Location:
- branches/ClassificationModelComparison/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ClassificationModelComparison/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/ConfusionMatrixCalculator.cs
r9119 r13091 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 31 31 } 32 32 33 IEnumerable<double> classValues = originalValues.Distinct();34 IEnumerable<double> estimatedClassValues = estimatedValues.Distinct();33 var classValues = originalValues.Distinct().ToList(); 34 var estimatedClassValues = estimatedValues.Distinct().ToList(); 35 35 36 if (!estimatedClassValues.All(x => originalValues.Contains(x))) {36 if (!estimatedClassValues.All(x => classValues.Contains(x))) { 37 37 errorState = OnlineCalculatorError.InvalidValueAdded; 38 38 return null; 39 39 } 40 40 41 int classes = classValues.Count ();41 int classes = classValues.Count; 42 42 double[,] confusionMatrix = new double[classes, classes]; 43 43 -
branches/ClassificationModelComparison/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/FOneScoreCalculator.cs
r9119 r13091 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 27 27 public class FOneScoreCalculator { 28 28 public static double Calculate(IEnumerable<double> originalValues, IEnumerable<double> estimatedValues, out OnlineCalculatorError errorState) { 29 if (originalValues.Distinct(). Count() != 2) {29 if (originalValues.Distinct().Skip(2).Any()) { 30 30 throw new ArgumentException("F1 score can only be calculated for binary classification."); 31 31 } … … 40 40 private static double CalculateFOne(double[,] confusionMatrix) { 41 41 double precision = confusionMatrix[0, 0] / (confusionMatrix[0, 0] + confusionMatrix[0, 1]); 42 43 42 double recall = confusionMatrix[0, 0] / (confusionMatrix[0, 0] + confusionMatrix[1, 0]); 44 43 -
branches/ClassificationModelComparison/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/MatthewsCorrelationCoefficientCalculator.cs
r9119 r13091 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab.
Note: See TracChangeset
for help on using the changeset viewer.