Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17509 for branches


Ignore:
Timestamp:
04/14/20 12:00:47 (4 years ago)
Author:
chaider
Message:

#2971:

  • Added cube, cuberoot, absolute and analytical quotient to IntervalInterpreter
  • Extended the IsCompatible method in IntervalInterpreter (removed power, root because not implemented in DerivativeCalculator
  • Added checks for known symbols at InteractiveSymbolicDataAnalysisSolutionSimplifierView and SymbolicRegressionSolution
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  
    4747    private const string TestNaNEvaluationsResultName = "Test NaN Evaluations";
    4848
    49     private const string IntervalEvaluationResultName = "Interval Evaluation";
     49    private const string ModelBoundsResultName = "Model Bounds";
    5050
    5151    public new ISymbolicRegressionModel Model {
     
    9898    }
    9999
    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; }
    103103    }
    104104
     
    127127      estimationLimitResults.Add(new Result(TestNaNEvaluationsResultName, "", new IntValue()));
    128128      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()));
    130130      RecalculateResults();
    131131    }
     
    147147        estimationLimitResults.Add(new Result(TestNaNEvaluationsResultName, "", new IntValue()));
    148148        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()));
    150154        CalculateResults();
    151155      }
     
    171175      TestNaNEvaluations = Model.Interpreter.GetSymbolicExpressionTreeValues(Model.SymbolicExpressionTree, ProblemData.Dataset, ProblemData.TestIndices).Count(double.IsNaN);
    172176
    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);
    174180    }
    175181
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs

    r17501 r17509  
    211211        }
    212212
    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            }
    221223          }
    222224        }
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/IntervalInterpreter.cs

    r17180 r17509  
    260260            break;
    261261          }
     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          }
    262286        default:
    263287          throw new NotSupportedException($"The tree contains the unknown symbol {currentInstr.dynamicNode.Symbol}");
     
    284308          !(n.Symbol is Logarithm) &&
    285309          !(n.Symbol is Exponential) &&
    286           !(n.Symbol is Power) &&
     310          //!(n.Symbol is Power) && //Interval Contains the symbol power, but the DerivativeCalculator does not!
    287311          !(n.Symbol is Square) &&
    288           !(n.Symbol is Root) &&
     312          //!(n.Symbol is Root) && //Interval Contains the symbol root, but the DerivativeCalculator does not!
    289313          !(n.Symbol is SquareRoot) &&
    290314          !(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)
    292320        select n).Any();
    293321      return !containsUnknownSyumbol;
Note: See TracChangeset for help on using the changeset viewer.