Changeset 16556 for branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolution.cs
- Timestamp:
- 01/25/19 10:30:24 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolution.cs
r15583 r16556 1 #region License Information1 #region License Information 2 2 /* HeuristicLab 3 3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) … … 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using System.Linq; 23 24 using HeuristicLab.Common; … … 27 28 using HeuristicLab.Optimization; 28 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 using HeuristicLab.Problems.DataAnalysis.Implementation; 29 31 30 32 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression { … … 47 49 private const string TestNaNEvaluationsResultName = "Test NaN Evaluations"; 48 50 51 private const string EstimatedDerivatesResultName = "Derivates of the Model"; 52 private const string EstimatedDerivationInterval = "Interval"; 53 49 54 public new ISymbolicRegressionModel Model { 50 55 get { return (ISymbolicRegressionModel)base.Model; } … … 95 100 private set { ((IntValue)EstimationLimitsResultCollection[TestNaNEvaluationsResultName].Value).Value = value; } 96 101 } 102 103 private ResultCollection EstimatedDerivateResultCollection => 104 (ResultCollection) this[EstimatedDerivatesResultName].Value; 105 106 public NamedIntervals EstimationInterval => 107 (NamedIntervals) EstimatedDerivateResultCollection[EstimatedDerivationInterval].Value; 108 97 109 98 110 [StorableConstructor] … … 119 131 Add(new Result(EstimationLimitsResultsResultName, "Results concerning the estimation limits of symbolic regression solution", estimationLimitResults)); 120 132 RecalculateResults(); 133 134 var estimationDerivatesResult = new ResultCollection(); 135 Add(new Result(EstimatedDerivatesResultName, "Results concerning the derivation of symbolic regression solution", estimationDerivatesResult)); 136 CalculateDerivates(estimationDerivatesResult); 121 137 } 122 138 … … 138 154 Add(new Result(EstimationLimitsResultsResultName, "Results concerning the estimation limits of symbolic regression solution", estimationLimitResults)); 139 155 CalculateResults(); 156 157 var estimationDerivatesResult = new ResultCollection(); 158 Add(new Result(EstimatedDerivatesResultName, "Results concerning the derivation of symbolic regression solution", estimationDerivatesResult)); 159 CalculateDerivates(estimationDerivatesResult); 140 160 } 141 161 } … … 146 166 } 147 167 168 private void CalculateDerivates(ResultCollection estimationDerivatesResults) { 169 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)); 184 } 185 } 186 estimationDerivatesResults.AddOrUpdateResult("Derived Intervals", intervals); 187 188 } 189 148 190 private void CalculateResults() { 149 191 ModelLength = Model.SymbolicExpressionTree.Length;
Note: See TracChangeset
for help on using the changeset viewer.