Changeset 12973 for trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.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/SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.cs
r12012 r12973 21 21 22 22 using System.Collections.Generic; 23 using System.Linq; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; … … 46 47 IEnumerable<int> rows = GenerateRowsToEvaluate(); 47 48 48 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value); 49 var problemData = ProblemDataParameter.ActualValue; 50 var interpreter = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue; 51 var estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows).ToArray(); 52 var targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows); 53 var estimationLimits = EstimationLimitsParameter.ActualValue; 54 55 if (SaveEstimatedValuesToScope) { 56 var boundedValues = estimatedValues.LimitToRange(estimationLimits.Lower, estimationLimits.Upper).ToArray(); 57 var scope = ExecutionContext.Scope; 58 if (scope.Variables.ContainsKey("EstimatedValues")) 59 scope.Variables["EstimatedValues"].Value = new DoubleArray(boundedValues); 60 else 61 scope.Variables.Add(new Core.Variable("EstimatedValues", new DoubleArray(boundedValues))); 62 } 63 64 double quality = Calculate(targetValues, estimatedValues, estimationLimits.Lower, estimationLimits.Upper, problemData, ApplyLinearScalingParameter.ActualValue.Value); 49 65 QualityParameter.ActualValue = new DoubleValue(quality); 50 66 … … 55 71 IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows); 56 72 IEnumerable<double> targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows); 73 return Calculate(targetValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, problemData, applyLinearScaling); 74 } 75 76 private static double Calculate(IEnumerable<double> targetValues, IEnumerable<double> estimatedValues, double lowerEstimationLimit, double upperEstimationLimit, IRegressionProblemData problemData, bool applyLinearScaling) { 57 77 OnlineCalculatorError errorState; 58 78
Note: See TracChangeset
for help on using the changeset viewer.