Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/21/18 10:27:55 (6 years ago)
Author:
chaider
Message:

#2956:

  • Updated value visualization of simplifier tooltip
  • Added VariableRanges field to dataset
  • Added overloads for GetSymbolicExressionTreeIntervals
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2956_apriori_knowledge/HeuristicLab.Algorithms.DataAnalysis.KnowledgeIntegration/3.4/Interpreter/SymbolicDataAnalysisIntervalArithmeticInterpreter.cs

    r16303 r16313  
    4242    private readonly object syncRoot = new object();
    4343
    44     private static InterpreterState PrepareInterpreterState(ISymbolicExpressionTree tree, IDataset dataset, IEnumerable<int> rows, Dictionary<string, Interval> customIntervals = null) {
     44    private static InterpreterState PrepareInterpreterState(ISymbolicExpressionTree tree,
     45      IEnumerable<int> rows, IDataset dataset = null, Dictionary<string, Interval> customIntervals = null) {
    4546      Instruction[] code = SymbolicExpressionTreeCompiler.Compile(tree, OpCodes.MapSymbolToOpCode);
    4647      int necessaryArgStackSize = 0;
     
    5152          IList<double> values = new List<double>();
    5253
    53           if (customIntervals != null && customIntervals.ContainsKey(variableTreeNode.VariableName)) {
    54             instr.data = customIntervals[variableTreeNode.VariableName];
     54          if (dataset != null && customIntervals != null) {
     55            if (customIntervals.ContainsKey(variableTreeNode.VariableName)) {
     56              instr.data = customIntervals[variableTreeNode.VariableName];
     57            } else {
     58              foreach (var rowEnum in rows) {
     59                values.Add(dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName)[rowEnum]);
     60              }
     61              instr.data = new Interval(values.Min(), values.Max());
     62            }
     63          } else if (dataset != null) {
     64             foreach (var rowEnum in rows) {
     65              values.Add(dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName)[rowEnum]);
     66            }
     67            instr.data = new Interval(values.Min(), values.Max());
     68          } else if (customIntervals != null) {
     69            if (customIntervals.ContainsKey(variableTreeNode.VariableName)) {
     70              instr.data = customIntervals[variableTreeNode.VariableName];
     71            }
    5572          } else {
    56             foreach (var rowEnum in rows) {
    57               values.Add(dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName)[rowEnum]);
    58             }
    59             instr.data = new Interval(values.Min(), values.Max());
     73            throw new Exception("No valid input for variables!");
    6074          }
    6175        }
     
    204218    //  var x = Evaluate(dataset, state);
    205219    //  state.Reset();
    206      
     220
    207221    //  return state;
    208222    //}
    209223
    210    // public Interval GetSymbolicExressionTreeInterval(tree,variableIntervals)
     224    // public Interval GetSymbolicExressionTreeInterval(tree,variableIntervals)
    211225    //public Interval GetSymbolicExressionTreeInterval(tree,Dataset,intervals = null)
     226
     227    public Interval GetSymbolicExressionTreeIntervals(ISymbolicExpressionTree tree, IEnumerable<int> rows, out Dictionary<ISymbolicExpressionTreeNode, Interval> intervals) {
     228      intervals = new Dictionary<ISymbolicExpressionTreeNode, Interval>();
     229      var state = PrepareInterpreterState(tree, rows);
     230      var x = Evaluate(state, intervals);
     231
     232      return x;
     233    }
     234
     235    public Interval GetSymbolicExressionTreeIntervals(ISymbolicExpressionTree tree, IDataset dataset, IEnumerable<int> rows,
     236      Dictionary<string, Interval> customIntervals, out Dictionary<ISymbolicExpressionTreeNode, Interval> intervals) {
     237      intervals = new Dictionary<ISymbolicExpressionTreeNode, Interval>();
     238      var state = PrepareInterpreterState(tree, rows, dataset, customIntervals);
     239      var x = Evaluate(state, intervals);
     240
     241      return x;
     242    }
     243
    212244    public Interval GetSymbolicExressionTreeIntervals(ISymbolicExpressionTree tree, IDataset dataset, IEnumerable<int> rows,
    213245      out Dictionary<ISymbolicExpressionTreeNode, Interval> intervals) {
    214246      intervals = new Dictionary<ISymbolicExpressionTreeNode, Interval>();
    215       var state = PrepareInterpreterState(tree, dataset, rows);
     247      var state = PrepareInterpreterState(tree, rows, dataset);
    216248      var x = Evaluate(state, intervals);
    217249     
Note: See TracChangeset for help on using the changeset viewer.