Changeset 12977 for trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionLogResidualEvaluator.cs
- Timestamp:
- 10/01/15 00:12:46 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionLogResidualEvaluator.cs
r12973 r12977 30 30 31 31 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression { 32 [Item("Log Residual Evaluator", "Evaluator for symbolic regression models that calculates the mean of logarithmic absolute residuals avg(log( 1 + abs(y' - y)))" + 32 [Item("Log Residual Evaluator", "Evaluator for symbolic regression models that calculates the mean of logarithmic absolute residuals avg(log( 1 + abs(y' - y)))" + 33 33 "This evaluator does not perform linear scaling!" + 34 34 "This evaluator can be useful if the modeled function contains discontinuities (e.g. 1/x). " + … … 57 57 IEnumerable<int> rows = GenerateRowsToEvaluate(); 58 58 59 var problemData = ProblemDataParameter.ActualValue; 60 var interpreter = SymbolicDataAnalysisTreeInterpreterParameter.ActualValue; 61 var estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows).ToArray(); 62 var targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows); 63 var estimationLimits = EstimationLimitsParameter.ActualValue; 64 65 if (SaveEstimatedValuesToScope) { 66 var boundedValues = estimatedValues.LimitToRange(estimationLimits.Lower, estimationLimits.Upper).ToArray(); 67 var scope = ExecutionContext.Scope; 68 if (scope.Variables.ContainsKey("EstimatedValues")) 69 scope.Variables["EstimatedValues"].Value = new DoubleArray(boundedValues); 70 else 71 scope.Variables.Add(new Core.Variable("EstimatedValues", new DoubleArray(boundedValues))); 72 } 73 74 double quality = Calculate(targetValues, estimatedValues, estimationLimits.Lower, estimationLimits.Upper); 59 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 75 60 QualityParameter.ActualValue = new DoubleValue(quality); 76 61 … … 81 66 IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows); 82 67 IEnumerable<double> targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows); 83 return Calculate(targetValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit);84 }85 86 private static double Calculate(IEnumerable<double> targetValues, IEnumerable<double> estimatedValues, double lowerEstimationLimit, double upperEstimationLimit) {87 68 IEnumerable<double> boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit); 88 69
Note: See TracChangeset
for help on using the changeset viewer.