public class InvertedFeature extends Object implements Comparable<InvertedFeature>
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.
Modifier and Type | Field and Description |
---|---|
double |
value |
Constructor and Description |
---|
InvertedFeature(double value,
int index) |
InvertedFeature(double value,
int[] indices) |
Modifier and Type | Method and Description |
---|---|
void |
add(int index) |
int |
compareTo(InvertedFeature o) |
InvertedFeature |
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.
|
String |
toString() |
public InvertedFeature(double value, int[] indices)
public InvertedFeature(double value, int index)
public void add(int index)
public int[] indices()
public void fixSize()
public com.oracle.labs.mlrg.olcut.util.Pair<InvertedFeature,InvertedFeature> split(IntArrayContainer allLeftIndices, IntArrayContainer buffer)
allLeftIndices
- The indices of the left branch.buffer
- The buffer to write out the unused indices to.public int compareTo(InvertedFeature o)
compareTo
in interface Comparable<InvertedFeature>
public InvertedFeature deepCopy()
Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.