Package org.ddogleg.nn.alg
Class AxisSplitterMedian<P>
java.lang.Object
org.ddogleg.nn.alg.AxisSplitterMedian<P>
- All Implemented Interfaces:
AxisSplitter<P>
Splits the points in K-D Tree node by selecting the axis with the largest variance. The point with the median
value along that axis is the split point. The data is segmented into left and right lists using the sorted list
used to find the median value.
-
Constructor Summary
ConstructorsConstructorDescriptionAxisSplitterMedian(KdTreeDistance<P> distance) Defaults to selecting the split axis with maximum varianceAxisSplitterMedian(KdTreeDistance<P> distance, AxisSplitRule splitRule) -
Method Summary
Modifier and TypeMethodDescriptionintNumber of elements in a pointintThe axis/dimension that the input list was split onintIndex associated with the split pointReturns the point used to split the datavoidsplitData(List<P> points, @Nullable DogArray_I32 indexes, List<P> left, @Nullable DogArray_I32 leftIndexes, List<P> right, @Nullable DogArray_I32 rightIndexes) Given the a set of points, select the axis to split the data along and select a point to divide the data.
-
Constructor Details
-
AxisSplitterMedian
-
AxisSplitterMedian
Defaults to selecting the split axis with maximum variance
-
-
Method Details
-
splitData
public void splitData(List<P> points, @Nullable @Nullable DogArray_I32 indexes, List<P> left, @Nullable @Nullable DogArray_I32 leftIndexes, List<P> right, @Nullable @Nullable DogArray_I32 rightIndexes) Description copied from interface:AxisSplitterGiven the a set of points, select the axis to split the data along and select a point to divide the data. Points whput items below the threshold into left and above into right. Data is optional and should be ignored if null. The selected- Specified by:
splitDatain interfaceAxisSplitter<P>- Parameters:
points- Input: Set of points.indexes- Input: (Optional) Option index asssociated with points. Can be null.left- Output: Storage for points less than the split point.leftIndexes- Output: (Optional) Storage for indexes associated with left. Can be null.right- Output: Storage for points more than the split point.rightIndexes- Output: (Optional) Storage for indexes associated with right. Can be null.
-
getSplitPoint
Description copied from interface:AxisSplitterReturns the point used to split the data- Specified by:
getSplitPointin interfaceAxisSplitter<P>
-
getSplitIndex
public int getSplitIndex()Description copied from interface:AxisSplitterIndex associated with the split point- Specified by:
getSplitIndexin interfaceAxisSplitter<P>
-
getSplitAxis
public int getSplitAxis()Description copied from interface:AxisSplitterThe axis/dimension that the input list was split on- Specified by:
getSplitAxisin interfaceAxisSplitter<P>
-
getPointLength
public int getPointLength()Description copied from interface:AxisSplitterNumber of elements in a point- Specified by:
getPointLengthin interfaceAxisSplitter<P>
-