Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/30/11 18:04:03 (14 years ago)
Author:
gkronber
Message:

#1453: Added an ErrorState property to online evaluators to indicate if the result value is valid or if there has been an error in the calculation. Adapted all classes that use one of the online evaluators to check this property.

Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs

    r5851 r5894  
    5858      IEnumerable<double> originalValues = problemData.Dataset.GetEnumeratedVariableValues(problemData.TargetVariable, rows);
    5959      IEnumerable<double> boundedEstimationValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit);
    60       double mse = OnlineMeanSquaredErrorEvaluator.Calculate(originalValues, boundedEstimationValues);
     60      OnlineEvaluatorError errorState;
     61      double mse = OnlineMeanSquaredErrorEvaluator.Calculate(originalValues, boundedEstimationValues, out errorState);
     62      if (errorState != OnlineEvaluatorError.None) mse = double.NaN;
    6163      return new double[2] { mse, solution.Length };
    6264    }
     
    7274      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
    7375      EstimationLimitsParameter.ExecutionContext = null;
    74       EvaluatedNodesParameter.ExecutionContext = null; 
     76      EvaluatedNodesParameter.ExecutionContext = null;
    7577
    7678      return quality;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs

    r5851 r5894  
    5858      IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows);
    5959      IEnumerable<double> originalValues = problemData.Dataset.GetEnumeratedVariableValues(problemData.TargetVariable, rows);
    60       double r2 = OnlinePearsonsRSquaredEvaluator.Calculate(estimatedValues, originalValues);
    61       return new double[] { double.IsNaN(r2) ? 0.0 : r2, solution.Length };
     60      OnlineEvaluatorError errorState;
     61      double r2 = OnlinePearsonsRSquaredEvaluator.Calculate(estimatedValues, originalValues, out errorState);
     62      if (errorState != OnlineEvaluatorError.None) r2 = 0.0;
     63      return new double[] { r2, solution.Length };
    6264    }
    6365
     
    7274      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
    7375      EstimationLimitsParameter.ExecutionContext = null;
    74       EvaluatedNodesParameter.ExecutionContext = null; 
     76      EvaluatedNodesParameter.ExecutionContext = null;
    7577
    7678      return quality;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveMeanSquaredErrorEvaluator.cs

    r5851 r5894  
    6060      IEnumerable<double> originalValues = problemData.Dataset.GetEnumeratedVariableValues(problemData.TargetVariable, rows);
    6161      IEnumerable<double> boundedEstimationValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit);
    62       return OnlineMeanSquaredErrorEvaluator.Calculate(originalValues, boundedEstimationValues);
     62      OnlineEvaluatorError errorState;
     63      double mse = OnlineMeanSquaredErrorEvaluator.Calculate(originalValues, boundedEstimationValues, out errorState);
     64      if (errorState != OnlineEvaluatorError.None) return double.NaN;
     65      else return mse;
    6366    }
    6467
     
    7477      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
    7578      EstimationLimitsParameter.ExecutionContext = null;
    76       EvaluatedNodesParameter.ExecutionContext = null; 
     79      EvaluatedNodesParameter.ExecutionContext = null;
    7780
    7881      return mse;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs

    r5851 r5894  
    6060      IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows);
    6161      IEnumerable<double> originalValues = problemData.Dataset.GetEnumeratedVariableValues(problemData.TargetVariable, rows);
    62       double r2 = OnlinePearsonsRSquaredEvaluator.Calculate(estimatedValues, originalValues);
    63       return double.IsNaN(r2) ? 0.0 : r2;
     62      OnlineEvaluatorError errorState;
     63      double r2 = OnlinePearsonsRSquaredEvaluator.Calculate(estimatedValues, originalValues, out errorState);
     64      if (errorState != OnlineEvaluatorError.None) return 0.0;
     65      else return r2;
    6466    }
    6567
     
    7476      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
    7577      EstimationLimitsParameter.ExecutionContext = null;
    76       EvaluatedNodesParameter.ExecutionContext = null; 
     78      EvaluatedNodesParameter.ExecutionContext = null;
    7779
    7880      return r2;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionModel.cs

    r5818 r5894  
    7575      double alpha;
    7676      double beta;
    77       OnlineLinearScalingParameterCalculator.Calculate(estimatedValues, targetValues, out alpha, out beta);
     77      OnlineEvaluatorError errorState;
     78      OnlineLinearScalingParameterCalculator.Calculate(estimatedValues, targetValues, out alpha, out beta, out errorState);
     79      if (errorState != OnlineEvaluatorError.None) return;
    7880
    7981      ConstantTreeNode alphaTreeNode = null;
Note: See TracChangeset for help on using the changeset viewer.