- Timestamp:
- 04/14/20 12:00:47 (4 years ago)
- Location:
- branches/2971_named_intervals
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolution.cs
r17206 r17509 47 47 private const string TestNaNEvaluationsResultName = "Test NaN Evaluations"; 48 48 49 private const string IntervalEvaluationResultName = "Interval Evaluation";49 private const string ModelBoundsResultName = "Model Bounds"; 50 50 51 51 public new ISymbolicRegressionModel Model { … … 98 98 } 99 99 100 public IntervalCollection IntervalEvaluationCollection {101 get { return (IntervalCollection)this[ IntervalEvaluationResultName].Value; }102 private set { this[ IntervalEvaluationResultName].Value = value; }100 public IntervalCollection ModelBoundsCollection { 101 get { return (IntervalCollection)this[ModelBoundsResultName].Value; } 102 private set { this[ModelBoundsResultName].Value = value; } 103 103 } 104 104 … … 127 127 estimationLimitResults.Add(new Result(TestNaNEvaluationsResultName, "", new IntValue())); 128 128 Add(new Result(EstimationLimitsResultsResultName, "Results concerning the estimation limits of symbolic regression solution", estimationLimitResults)); 129 Add(new Result( IntervalEvaluationResultName, "Results concerning the derivation of symbolic regression solution", new IntervalCollection()));129 Add(new Result(ModelBoundsResultName, "Results concerning the derivation of symbolic regression solution", new IntervalCollection())); 130 130 RecalculateResults(); 131 131 } … … 147 147 estimationLimitResults.Add(new Result(TestNaNEvaluationsResultName, "", new IntValue())); 148 148 Add(new Result(EstimationLimitsResultsResultName, "Results concerning the estimation limits of symbolic regression solution", estimationLimitResults)); 149 Add(new Result(IntervalEvaluationResultName, "Results concerning the derivation of symbolic regression solution", new IntervalCollection())); 149 CalculateResults(); 150 } 151 152 if (!ContainsKey(ModelBoundsResultName)) { 153 Add(new Result(ModelBoundsResultName, "Results concerning the derivation of symbolic regression solution", new IntervalCollection())); 150 154 CalculateResults(); 151 155 } … … 171 175 TestNaNEvaluations = Model.Interpreter.GetSymbolicExpressionTreeValues(Model.SymbolicExpressionTree, ProblemData.Dataset, ProblemData.TestIndices).Count(double.IsNaN); 172 176 173 IntervalEvaluationCollection = CalculateModelIntervals(this); 177 //Check if the tree contains unknown symbols for the interval calculation 178 if (IntervalInterpreter.IsCompatible(Model.SymbolicExpressionTree)) 179 ModelBoundsCollection = CalculateModelIntervals(this); 174 180 } 175 181 -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs
r17501 r17509 211 211 } 212 212 213 var regressionProblemData = Content.ProblemData as IRegressionProblemData; 214 if (regressionProblemData != null) { 215 var interpreter = new IntervalInterpreter(); 216 var variableRanges = regressionProblemData.VariableRanges.GetIntervals(); 217 IDictionary<ISymbolicExpressionTreeNode, Interval> intervals; 218 interpreter.GetSymbolicExpressionTreeIntervals(tree, variableRanges, out intervals); 219 foreach (var kvp in intervals) { 220 nodeIntervals[kvp.Key] = kvp.Value; 213 if (IntervalInterpreter.IsCompatible(tree)) { 214 var regressionProblemData = Content.ProblemData as IRegressionProblemData; 215 if (regressionProblemData != null) { 216 var interpreter = new IntervalInterpreter(); 217 var variableRanges = regressionProblemData.VariableRanges.GetIntervals(); 218 IDictionary<ISymbolicExpressionTreeNode, Interval> intervals; 219 interpreter.GetSymbolicExpressionTreeIntervals(tree, variableRanges, out intervals); 220 foreach (var kvp in intervals) { 221 nodeIntervals[kvp.Key] = kvp.Value; 222 } 221 223 } 222 224 } -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalInterpreter.cs
r17180 r17509 260 260 break; 261 261 } 262 case OpCodes.Cube: { 263 var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals); 264 result = Interval.Cube(argumentInterval); 265 break; 266 } 267 case OpCodes.CubeRoot: { 268 var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals); 269 result = Interval.CubicRoot(argumentInterval); 270 break; 271 } 272 case OpCodes.Absolute: { 273 var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals); 274 result = Interval.Absolute(argumentInterval); 275 break; 276 } 277 case OpCodes.AnalyticQuotient: { 278 result = Evaluate(instructions, ref instructionCounter, nodeIntervals); 279 for (var i = 1; i < currentInstr.nArguments; i++) { 280 var argumentInterval = Evaluate(instructions, ref instructionCounter, nodeIntervals); 281 result = Interval.AnalyticalQuotient(result, argumentInterval); 282 } 283 284 break; 285 } 262 286 default: 263 287 throw new NotSupportedException($"The tree contains the unknown symbol {currentInstr.dynamicNode.Symbol}"); … … 284 308 !(n.Symbol is Logarithm) && 285 309 !(n.Symbol is Exponential) && 286 !(n.Symbol is Power) &&310 //!(n.Symbol is Power) && //Interval Contains the symbol power, but the DerivativeCalculator does not! 287 311 !(n.Symbol is Square) && 288 !(n.Symbol is Root) &&312 //!(n.Symbol is Root) && //Interval Contains the symbol root, but the DerivativeCalculator does not! 289 313 !(n.Symbol is SquareRoot) && 290 314 !(n.Symbol is Problems.DataAnalysis.Symbolic.Variable) && 291 !(n.Symbol is Constant) 315 !(n.Symbol is Constant) && 316 !(n.Symbol is Cube) && 317 !(n.Symbol is CubeRoot) && 318 !(n.Symbol is Absolute) && 319 !(n.Symbol is AnalyticQuotient) 292 320 select n).Any(); 293 321 return !containsUnknownSyumbol;
Note: See TracChangeset
for help on using the changeset viewer.