Changeset 16851 for branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolution.cs
- Timestamp:
- 04/19/19 14:35:08 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolution.cs
r16830 r16851 98 98 } 99 99 100 101 100 public NamedIntervals IntervalEvaluationCollection { 102 101 get { return (NamedIntervals)this[IntervalEvaluationResultName].Value; } … … 128 127 estimationLimitResults.Add(new Result(TestNaNEvaluationsResultName, "", new IntValue())); 129 128 Add(new Result(EstimationLimitsResultsResultName, "Results concerning the estimation limits of symbolic regression solution", estimationLimitResults)); 130 Add(new Result(IntervalEvaluationResultName, "Results concerning the derivation of symbolic regression solution", GetIntervalEvaluations()));129 Add(new Result(IntervalEvaluationResultName, "Results concerning the derivation of symbolic regression solution", new NamedIntervals())); 131 130 RecalculateResults(); 132 131 } … … 148 147 estimationLimitResults.Add(new Result(TestNaNEvaluationsResultName, "", new IntValue())); 149 148 Add(new Result(EstimationLimitsResultsResultName, "Results concerning the estimation limits of symbolic regression solution", estimationLimitResults)); 150 Add(new Result(IntervalEvaluationResultName, "Results concerning the derivation of symbolic regression solution", GetIntervalEvaluations()));149 Add(new Result(IntervalEvaluationResultName, "Results concerning the derivation of symbolic regression solution", new NamedIntervals())); 151 150 CalculateResults(); 152 151 } … … 156 155 base.RecalculateResults(); 157 156 CalculateResults(); 158 }159 160 private NamedIntervals GetIntervalEvaluations() {161 var intervalEvaluation = new NamedIntervals();162 var interpreter = new IntervalInterpreter();163 var variableRanges = ProblemData.VariableRanges.VariableIntervals;164 165 if (variableRanges != null) {166 intervalEvaluation.VariableIntervals.Add($"Target {ProblemData.TargetVariable}", new Interval(variableRanges[ProblemData.TargetVariable].LowerBound, variableRanges[ProblemData.TargetVariable].UpperBound));167 intervalEvaluation.VariableIntervals.Add("Modell Interval", interpreter.GetSymbolicExpressionTreeInterval(Model.SymbolicExpressionTree, variableRanges));168 169 foreach (var derivate in variableRanges) {170 if (derivate.Key != ProblemData.TargetVariable) {171 var derived = DerivativeCalculator.Derive(Model.SymbolicExpressionTree, derivate.Key);172 var derivedResultInterval = interpreter.GetSymbolicExpressionTreeInterval(derived, variableRanges);173 174 intervalEvaluation.VariableIntervals.Add(" \u2202f/\u2202" + derivate.Key,175 new Interval(derivedResultInterval.LowerBound, derivedResultInterval.UpperBound));176 }177 }178 }179 return intervalEvaluation;180 157 } 181 158 … … 194 171 TestNaNEvaluations = Model.Interpreter.GetSymbolicExpressionTreeValues(Model.SymbolicExpressionTree, ProblemData.Dataset, ProblemData.TestIndices).Count(double.IsNaN); 195 172 196 IntervalEvaluationCollection = GetIntervalEvaluations(); 173 IntervalEvaluationCollection = CalculateModelIntervals(this); 174 } 175 176 private static NamedIntervals CalculateModelIntervals(ISymbolicRegressionSolution solution) { 177 var intervalEvaluation = new NamedIntervals(); 178 var interpreter = new IntervalInterpreter(); 179 var problemData = solution.ProblemData; 180 var model = solution.Model; 181 var variableRanges = problemData.VariableRanges.VariableIntervals; 182 183 intervalEvaluation.VariableIntervals.Add($"Target {problemData.TargetVariable}", new Interval(variableRanges[problemData.TargetVariable].LowerBound, variableRanges[problemData.TargetVariable].UpperBound)); 184 intervalEvaluation.VariableIntervals.Add("Model Interval", interpreter.GetSymbolicExpressionTreeInterval(model.SymbolicExpressionTree, variableRanges)); 185 186 foreach (var inputVariable in model.VariablesUsedForPrediction.OrderBy(v => v, new NaturalStringComparer())) { 187 var derivedModel = DerivativeCalculator.Derive(model.SymbolicExpressionTree, inputVariable); 188 var derivedResultInterval = interpreter.GetSymbolicExpressionTreeInterval(derivedModel, variableRanges); 189 190 intervalEvaluation.VariableIntervals.Add(" \u2202f/\u2202" + inputVariable, 191 new Interval(derivedResultInterval.LowerBound, derivedResultInterval.UpperBound)); 192 } 193 194 return intervalEvaluation; 197 195 } 198 196 }
Note: See TracChangeset
for help on using the changeset viewer.