Class InvertedFeature
java.lang.Object
org.tribuo.regression.rtree.impl.InvertedFeature
- All Implemented Interfaces:
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInvertedFeature
(double value, int index) InvertedFeature
(double value, int[] indices) -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(int index) int
deepCopy()
void
fixSize()
int[]
indices()
com.oracle.labs.mlrg.olcut.util.Pair
<InvertedFeature, InvertedFeature> split
(IntArrayContainer allLeftIndices, IntArrayContainer buffer) Relies upon allLeftIndices being sorted in ascending order.toString()
-
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
- Specified by:
compareTo
in interfaceComparable<InvertedFeature>
-
toString
-
deepCopy
-