Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12375


Ignore:
Timestamp:
05/04/15 11:54:43 (10 years ago)
Author:
gkronber
Message:

#2283: made TreeNodes structs instead of classes

File:
1 edited

Legend:

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

    r12372 r12375  
    1515    // trees are represented as a flat array
    1616    // object-graph-travesal has problems if this is defined as a struct. TODO investigate...
    17     [StorableClass]
    18     public class TreeNode {
     17    //[StorableClass]
     18    public struct TreeNode {
    1919      public readonly static string NO_VARIABLE = string.Empty;
    20       [Storable]
     20      //[Storable]
    2121      public string varName; // name of the variable for splitting or -1 if terminal node
    22       [Storable]
     22      //[Storable]
    2323      public double val; // threshold
    24       [Storable]
     24      //[Storable]
    2525      public int leftIdx;
    26       [Storable]
     26      //[Storable]
    2727      public int rightIdx;
    2828
    29       public TreeNode() {
    30         varName = NO_VARIABLE;
    31         leftIdx = -1;
    32         rightIdx = -1;
     29      //public TreeNode() {
     30      //  varName = NO_VARIABLE;
     31      //  leftIdx = -1;
     32      //  rightIdx = -1;
     33      //}
     34      //[StorableConstructor]
     35      //private TreeNode(bool deserializing) { }
     36      public override int GetHashCode()
     37      {
     38        return (leftIdx * rightIdx) ^ val.GetHashCode();
    3339      }
    34       [StorableConstructor]
    35       private TreeNode(bool deserializing) { }
    3640    }
    3741
Note: See TracChangeset for help on using the changeset viewer.