Class InvertedFeature

java.lang.Object
org.tribuo.regression.rtree.impl.InvertedFeature
All Implemented Interfaces:
Comparable<InvertedFeature>

public class InvertedFeature extends Object implements Comparable<InvertedFeature>
Internal datastructure for implementing a decision tree.

Represents a single value and feature tuple, with associated arrays for the indicies where that combination occurs.

Indices and values must be inserted in sorted ascending order or everything will break. This code does not check that this invariant is maintained.

Note: this class has a natural ordering that is inconsistent with equals.

  • Field Details

    • value

      public final double value
  • Constructor Details

    • InvertedFeature

      public InvertedFeature(double value, int[] indices)
    • InvertedFeature

      public InvertedFeature(double value, int index)
  • Method Details

    • add

      public void add(int index)
    • indices

      public int[] indices()
    • fixSize

      public void fixSize()
    • split

      public com.oracle.labs.mlrg.olcut.util.Pair<InvertedFeature, InvertedFeature> split(IntArrayContainer allLeftIndices, IntArrayContainer buffer)
      Relies upon allLeftIndices being sorted in ascending order. Undefined when it's not.
      Parameters:
      allLeftIndices - The indices of the left branch.
      buffer - The buffer to write out the unused indices to.
      Returns:
      A pair, with the first element the left branch and the second element the right branch.
    • compareTo

      public int compareTo(InvertedFeature o)
      Specified by:
      compareTo in interface Comparable<InvertedFeature>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • deepCopy

      public InvertedFeature deepCopy()