Class TreeFeature

All Implemented Interfaces:

public class TreeFeature extends Object implements Iterable<InvertedFeature>
An inverted feature, which stores a reference to all the values of this feature.

Can be split into two values based on an example index list.

  • Constructor Details

    • TreeFeature

      public TreeFeature(int id)
      Constructs an inverted feature with the specified feature id.
      id - The feature id.
  • Method Details

    • iterator

      public Iterator<InvertedFeature> iterator()
      Specified by:
      iterator in interface Iterable<InvertedFeature>
    • getFeature

      public List<InvertedFeature> getFeature()
      Gets the inverted feature values for this feature.
      The list of feature values.
    • observeValue

      public void observeValue(double value, int exampleID)
      Observes a value for this feature.
      value - The value observed.
      exampleID - The example id number.
    • sort

      public void sort()
      Sort the list using InvertedFeature's natural ordering. Must be done after all elements are inserted.
    • fixSize

      public void fixSize()
      Fixes the size of each InvertedFeature's inner arrays.
    • split

      public<TreeFeature,TreeFeature> split(int[] leftIndices, int[] rightIndices, IntArrayContainer firstBuffer, IntArrayContainer secondBuffer)
      Splits this tree feature into two.
      leftIndices - The indices to go in the left branch.
      rightIndices - The indices to go in the right branch.
      firstBuffer - A buffer for temporary work.
      secondBuffer - A buffer for temporary work.
      A pair of TreeFeatures, the first element is the left branch, the second the right.
    • toString

      public String toString()
      toString in class Object
    • deepCopy

      public TreeFeature deepCopy()
      Returns a deep copy of this tree feature.
      A deep copy.