Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/07/15 11:57:37 (9 years ago)
Author:
gkronber
Message:

#2261 implemented node expansion using a priority queue (and changed parameter MaxDepth to MaxSize). Moved unit tests to a separate project.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GBT-trunkintegration/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/RegressionTreeModel.cs

    r12590 r12632  
    3636    public struct TreeNode {
    3737      public readonly static string NO_VARIABLE = string.Empty;
    38       public string varName; // name of the variable for splitting or -1 if terminal node
    39       public double val; // threshold
    40       public int leftIdx;
    41       public int rightIdx;
     38      public string VarName { get; set; } // name of the variable for splitting or -1 if terminal node
     39      public double Val { get; set; } // threshold
     40      public int LeftIdx { get; set; }
     41      public int RightIdx { get; set; }
    4242
    4343      public override int GetHashCode() {
    44         return leftIdx ^ rightIdx ^ val.GetHashCode();
     44        return LeftIdx ^ RightIdx ^ Val.GetHashCode();
    4545      }
    4646    }
     
    6464    private static double GetPredictionForRow(TreeNode[] t, int nodeIdx, IDataset ds, int row) {
    6565      var node = t[nodeIdx];
    66       if (node.varName == TreeNode.NO_VARIABLE)
    67         return node.val;
    68       else if (ds.GetDoubleValue(node.varName, row) <= node.val)
    69         return GetPredictionForRow(t, node.leftIdx, ds, row);
     66      if (node.VarName == TreeNode.NO_VARIABLE)
     67        return node.Val;
     68      else if (ds.GetDoubleValue(node.VarName, row) <= node.Val)
     69        return GetPredictionForRow(t, node.LeftIdx, ds, row);
    7070      else
    71         return GetPredictionForRow(t, node.rightIdx, ds, row);
     71        return GetPredictionForRow(t, node.RightIdx, ds, row);
    7272    }
    7373
Note: See TracChangeset for help on using the changeset viewer.