Ignore:
Timestamp:
02/05/19 14:50:21 (3 months ago)
Author:
chaider
Message:

#2971

  • Added new Evaluator to evaulate Pearson RSquared with repsect to given constraints
  • changes in SymbolicRegressionSolution
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolution.cs

    r16556 r16589  
    4949    private const string TestNaNEvaluationsResultName = "Test NaN Evaluations";
    5050
    51     private const string EstimatedDerivatesResultName = "Derivates of the Model";
     51    private const string IntervalEvaluationResultName = "Interval Evaluation";
    5252    private const string EstimatedDerivationInterval = "Interval";
    5353
     
    101101    }
    102102
    103     private ResultCollection EstimatedDerivateResultCollection =>
    104       (ResultCollection) this[EstimatedDerivatesResultName].Value;
    105 
    106     public NamedIntervals EstimationInterval =>
    107       (NamedIntervals) EstimatedDerivateResultCollection[EstimatedDerivationInterval].Value;
     103    private NamedIntervals IntervalEvaluaitonCollection =>
     104      (NamedIntervals) this[IntervalEvaluationResultName].Value;
     105
    108106
    109107
     
    132130      RecalculateResults();
    133131
    134       var estimationDerivatesResult = new ResultCollection();
    135       Add(new Result(EstimatedDerivatesResultName, "Results concerning the derivation of symbolic regression solution", estimationDerivatesResult));
    136       CalculateDerivates(estimationDerivatesResult);
     132      var namedIntervalCollection = new NamedIntervals();
     133      Add(new Result(IntervalEvaluationResultName, "Results concerning the derivation of symbolic regression solution", namedIntervalCollection));
     134      GetIntervalEvaulations(namedIntervalCollection);
    137135    }
    138136
     
    155153        CalculateResults();
    156154
    157         var estimationDerivatesResult = new ResultCollection();
    158         Add(new Result(EstimatedDerivatesResultName, "Results concerning the derivation of symbolic regression solution", estimationDerivatesResult));
    159         CalculateDerivates(estimationDerivatesResult);
     155        var namedIntervalCollection = new NamedIntervals();
     156        Add(new Result(IntervalEvaluationResultName, "Results concerning the derivation of symbolic regression solution", namedIntervalCollection));
     157        GetIntervalEvaulations(namedIntervalCollection);
    160158      }
    161159    }
     
    166164    }
    167165
    168     private void CalculateDerivates(ResultCollection estimationDerivatesResults) {
     166    private void GetIntervalEvaulations(NamedIntervals intervalEvaluation) {
    169167      var interpreter = new IntervalInterpreter();
    170       var variableRanges = (ProblemData as RegressionProblemData).VariableRangesParameter.Value.VariableIntervals;
    171       var customIntervals = new Dictionary<string, Interval>();
    172       var intervals = new NamedIntervals();
    173 
    174       foreach (var variable in variableRanges) {
    175         customIntervals.Add(variable.Key, new Interval(variable.Value.LowerBound, variable.Value.UpperBound));
    176       }
    177 
    178       foreach (var derivate in customIntervals) {
    179         if (derivate.Key != ProblemData.TargetVariable) {
    180           var derived = DerivativeCalculator.Derive(Model.SymbolicExpressionTree, derivate.Key);
    181           var derivedResultInterval = interpreter.GetSymbolicExressionTreeInterval(derived, customIntervals);
    182           intervals.Add(" ∂f/∂" + derivate.Key,
    183             new Interval(derivedResultInterval.LowerBound, derivedResultInterval.UpperBound));
     168      var variableRanges = (ProblemData as RegressionProblemData)?.VariableRangesParameter.Value.VariableIntervals;
     169
     170      if (variableRanges != null) {
     171        intervalEvaluation.Add($"Target {ProblemData.TargetVariable}", new Interval(variableRanges[ProblemData.TargetVariable].LowerBound, variableRanges[ProblemData.TargetVariable].UpperBound));
     172        intervalEvaluation.Add("Modell Interval", interpreter.GetSymbolicExressionTreeInterval(Model.SymbolicExpressionTree, variableRanges));
     173
     174        foreach (var derivate in variableRanges) {
     175          if (derivate.Key != ProblemData.TargetVariable) {
     176            var derived = DerivativeCalculator.Derive(Model.SymbolicExpressionTree, derivate.Key);
     177            var derivedResultInterval = interpreter.GetSymbolicExressionTreeInterval(derived, variableRanges);
     178            intervalEvaluation.Add(" ∂f/∂" + derivate.Key,
     179              new Interval(derivedResultInterval.LowerBound, derivedResultInterval.UpperBound));
     180          }
    184181        }
    185182      }
    186       estimationDerivatesResults.AddOrUpdateResult("Derived Intervals", intervals);
    187 
    188183    }
    189184   
Note: See TracChangeset for help on using the changeset viewer.