Changeset 12632 for branches/GBT-trunkintegration/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/RegressionTreeModel.cs
- Timestamp:
- 07/07/15 11:57:37 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GBT-trunkintegration/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/RegressionTreeModel.cs
r12590 r12632 36 36 public struct TreeNode { 37 37 public readonly static string NO_VARIABLE = string.Empty; 38 public string varName;// name of the variable for splitting or -1 if terminal node39 public double val;// threshold40 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; } 42 42 43 43 public override int GetHashCode() { 44 return leftIdx ^ rightIdx ^ val.GetHashCode();44 return LeftIdx ^ RightIdx ^ Val.GetHashCode(); 45 45 } 46 46 } … … 64 64 private static double GetPredictionForRow(TreeNode[] t, int nodeIdx, IDataset ds, int row) { 65 65 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); 70 70 else 71 return GetPredictionForRow(t, node. rightIdx, ds, row);71 return GetPredictionForRow(t, node.RightIdx, ds, row); 72 72 } 73 73
Note: See TracChangeset
for help on using the changeset viewer.