Changeset 12302 for branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveWeightedPerformanceMeasuresEvaluator.cs
- Timestamp:
- 04/13/15 11:59:52 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveWeightedPerformanceMeasuresEvaluator.cs
r12218 r12302 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Linq; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; … … 101 102 IEnumerable<int> rows, bool applyLinearScaling, ISymbolicClassificationModelCreator modelCreator, double normalizedMeanSquaredErrorWeightingFactor, double falseNegativeRateWeightingFactor, double falsePositiveRateWeightingFactor) { 102 103 IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows); 103 IEnumerable<double> targetClassValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);104 IEnumerable<double> boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit);104 var targetClassValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows).ToArray(); 105 var boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit).ToArray(); 105 106 OnlineCalculatorError errorState; 106 107 double nmse; … … 115 116 var estimatedClassValues = model.GetEstimatedClassValues(boundedEstimatedValues); 116 117 performanceCalculator.Calculate(targetClassValues, estimatedClassValues); 117 if (performanceCalculator.ErrorState != OnlineCalculatorError.None) 118 if (performanceCalculator.ErrorState != OnlineCalculatorError.None) 118 119 return Double.NaN; 119 120 double falseNegativeRate = 1 - performanceCalculator.TruePositiveRate; … … 121 122 122 123 if (applyLinearScaling) { 123 var nmseCalculator = new OnlineNormalizedMeanSquaredErrorCalculator(); 124 CalculateWithScaling(targetClassValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, nmseCalculator, problemData.Dataset.Rows); 125 errorState = nmseCalculator.ErrorState; 126 nmse = nmseCalculator.NormalizedMeanSquaredError; 127 } else { 128 nmse = OnlineNormalizedMeanSquaredErrorCalculator.Calculate(targetClassValues, boundedEstimatedValues, out errorState); 124 throw new NotSupportedException("The Weighted Performance Measures Evaluator does not suppport linear scaling!"); 129 125 } 126 nmse = OnlineNormalizedMeanSquaredErrorCalculator.Calculate(targetClassValues, boundedEstimatedValues, out errorState); 130 127 if (errorState != OnlineCalculatorError.None) return Double.NaN; 131 132 128 return normalizedMeanSquaredErrorWeightingFactor * nmse + falseNegativeRateWeightingFactor * falseNegativeRate + falsePositiveRateWeightingFactor * falsePositiveRate; 133 129 }
Note: See TracChangeset
for help on using the changeset viewer.