Changeset 12973 for trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs
- Timestamp:
- 09/29/15 16:49:13 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs
r12641 r12973 21 21 22 22 using System.Collections.Generic; 23 using System.Linq; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; … … 48 49 IEnumerable<int> rows = GenerateRowsToEvaluate(); 49 50 50 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value); 51 var problemData = ProblemDataParameter.ActualValue; 52 var interpreter = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue; 53 var estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows).ToArray(); 54 var targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows); 55 var estimationLimits = EstimationLimitsParameter.ActualValue; 56 57 if (SaveEstimatedValuesToScope) { 58 var boundedValues = estimatedValues.LimitToRange(estimationLimits.Lower, estimationLimits.Upper).ToArray(); 59 var scope = ExecutionContext.Scope; 60 if (scope.Variables.ContainsKey("EstimatedValues")) 61 scope.Variables["EstimatedValues"].Value = new DoubleArray(boundedValues); 62 else 63 scope.Variables.Add(new Core.Variable("EstimatedValues", new DoubleArray(boundedValues))); 64 } 65 66 double quality = Calculate(targetValues, estimatedValues, estimationLimits.Lower, estimationLimits.Upper, problemData, ApplyLinearScalingParameter.ActualValue.Value); 51 67 QualityParameter.ActualValue = new DoubleValue(quality); 52 68 … … 57 73 IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows); 58 74 IEnumerable<double> targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows); 75 return Calculate(targetValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, problemData, applyLinearScaling); 76 } 77 78 private static double Calculate(IEnumerable<double> targetValues, IEnumerable<double> estimatedValues, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, bool applyLinearScaling) { 59 79 OnlineCalculatorError errorState; 60 80 … … 70 90 } 71 91 if (errorState != OnlineCalculatorError.None) return double.NaN; 72 return r *r;92 return r * r; 73 93 } 74 94
Note: See TracChangeset
for help on using the changeset viewer.