Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/21/16 17:59:36 (7 years ago)
Author:
gkronber
Message:

#2690: implemented methods to generate symbolic expression tree solutions for decision tree models (random forest and gradient boosted) as well as views which make it possible to inspect each of the individual trees in a GBT and RF solution

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs

    r14185 r14345  
    471471            if (row < 0 || row >= dataset.Rows) return double.NaN;
    472472            var variableConditionTreeNode = (VariableConditionTreeNode)currentInstr.dynamicNode;
    473             double variableValue = ((IList<double>)currentInstr.data)[row];
    474             double x = variableValue - variableConditionTreeNode.Threshold;
    475             double p = 1 / (1 + Math.Exp(-variableConditionTreeNode.Slope * x));
    476 
    477             double trueBranch = Evaluate(dataset, ref row, state);
    478             double falseBranch = Evaluate(dataset, ref row, state);
    479 
    480             return trueBranch * p + falseBranch * (1 - p);
     473            if (!variableConditionTreeNode.Symbol.IgnoreSlope) {
     474              double variableValue = ((IList<double>)currentInstr.data)[row];
     475              double x = variableValue - variableConditionTreeNode.Threshold;
     476              double p = 1 / (1 + Math.Exp(-variableConditionTreeNode.Slope * x));
     477
     478              double trueBranch = Evaluate(dataset, ref row, state);
     479              double falseBranch = Evaluate(dataset, ref row, state);
     480
     481              return trueBranch * p + falseBranch * (1 - p);
     482            } else {
     483              // strict threshold
     484              double variableValue = ((IList<double>)currentInstr.data)[row];
     485              if (variableValue <= variableConditionTreeNode.Threshold) {
     486                var left = Evaluate(dataset, ref row, state);
     487                state.SkipInstructions();
     488                return left;
     489              } else {
     490                state.SkipInstructions();
     491                return Evaluate(dataset, ref row, state);
     492              }
     493            }
    481494          }
    482495        default:
Note: See TracChangeset for help on using the changeset viewer.