Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/01/15 00:12:46 (9 years ago)
Author:
bburlacu
Message:

#2480: Reverted changes to the evaluators as they impact performance and memory usage.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionLogResidualEvaluator.cs

    r12973 r12977  
    3030
    3131namespace 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)))" + 
    3333                                  "This evaluator does not perform linear scaling!" +
    3434                                  "This evaluator can be useful if the modeled function contains discontinuities (e.g. 1/x). " +
     
    5757      IEnumerable<int> rows = GenerateRowsToEvaluate();
    5858
    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);
    7560      QualityParameter.ActualValue = new DoubleValue(quality);
    7661
     
    8166      IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows);
    8267      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) {
    8768      IEnumerable<double> boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit);
    8869
Note: See TracChangeset for help on using the changeset viewer.