Changeset 12216 for branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective
- Timestamp:
- 03/17/15 15:56:40 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveWeightedPerformanceMeasuresEvaluator.cs
r12211 r12216 30 30 31 31 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.SingleObjective { 32 [Item("Weighted Performance Measures Evaluator", "Calculates the quality a symbolic classification solution based on three weighted measures(normalized mean squared error, false negative rate and false positve rate).")]32 [Item("Weighted Performance Measures Evaluator", "Calculates the quality of a symbolic classification solution based on three weighted measures(normalized mean squared error, false negative rate(1-sensitivity) and false positve rate(1-specificity)).")] 33 33 [StorableClass] 34 34 public class SymbolicClassificationSingleObjectiveWeightedPerformanceMeasuresEvaluator : SymbolicClassificationSingleObjectiveEvaluator { … … 101 101 IEnumerable<int> rows, bool applyLinearScaling, ISymbolicClassificationModelCreator modelCreator, double normalizedMeanSquaredErrorWeightingFactor, double falseNegativeRateWeightingFactor, double falsePositiveRateWeightingFactor) { 102 102 IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows); 103 IEnumerable<double> target Values = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);103 IEnumerable<double> targetClassValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows); 104 104 OnlineCalculatorError errorState; 105 105 double nmse; 106 106 107 107 //calculate performance measures 108 var model = modelCreator.CreateSymbolicClassificationModel(solution, interpreter, lowerEstimationLimit, upperEstimationLimit);108 var model = (ISymbolicDiscriminantFunctionClassificationModel)modelCreator.CreateSymbolicClassificationModel(solution, interpreter, lowerEstimationLimit, upperEstimationLimit); 109 109 string positiveClassName = problemData.PositiveClass; 110 model.RecalculateModelParameters(problemData, rows); 110 double[] classValues, thresholds; 111 model.ThresholdCalculator.Calculate(problemData, estimatedValues, targetClassValues, out classValues, out thresholds); 112 model.SetThresholdsAndClassValues(thresholds, classValues); 111 113 var performanceCalculator = new ClassificationPerformanceMeasuresCalculator(positiveClassName, problemData.GetClassValue(positiveClassName)); 112 var estimatedClassValues = model.GetEstimatedClassValues( problemData.Dataset, rows);113 performanceCalculator.Calculate( estimatedClassValues, targetValues);114 var estimatedClassValues = model.GetEstimatedClassValues(estimatedValues); 115 performanceCalculator.Calculate(targetClassValues, estimatedClassValues); 114 116 if (performanceCalculator.ErrorState != OnlineCalculatorError.None) 115 117 return Double.NaN; … … 119 121 if (applyLinearScaling) { 120 122 var nmseCalculator = new OnlineNormalizedMeanSquaredErrorCalculator(); 121 CalculateWithScaling(target Values, estimatedValues, lowerEstimationLimit, upperEstimationLimit, nmseCalculator, problemData.Dataset.Rows);123 CalculateWithScaling(targetClassValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, nmseCalculator, problemData.Dataset.Rows); 122 124 errorState = nmseCalculator.ErrorState; 123 125 nmse = nmseCalculator.NormalizedMeanSquaredError; 124 126 } else { 125 127 IEnumerable<double> boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit); 126 nmse = OnlineNormalizedMeanSquaredErrorCalculator.Calculate(target Values, boundedEstimatedValues, out errorState);128 nmse = OnlineNormalizedMeanSquaredErrorCalculator.Calculate(targetClassValues, boundedEstimatedValues, out errorState); 127 129 } 128 130 if (errorState != OnlineCalculatorError.None) return Double.NaN;
Note: See TracChangeset
for help on using the changeset viewer.