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
ConstructorDescriptionAxisSplitterMedian
(KdTreeDistance<P> distance) Defaults to selecting the split axis with maximum varianceAxisSplitterMedian
(KdTreeDistance<P> distance, AxisSplitRule splitRule) -
Method Summary
Modifier and TypeMethodDescriptionint
Number of elements in a pointint
The axis/dimension that the input list was split onint
Index associated with the split pointReturns the point used to split the datavoid
splitData
(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:AxisSplitter
Given 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:
splitData
in 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:AxisSplitter
Returns the point used to split the data- Specified by:
getSplitPoint
in interfaceAxisSplitter<P>
-
getSplitIndex
public int getSplitIndex()Description copied from interface:AxisSplitter
Index associated with the split point- Specified by:
getSplitIndex
in interfaceAxisSplitter<P>
-
getSplitAxis
public int getSplitAxis()Description copied from interface:AxisSplitter
The axis/dimension that the input list was split on- Specified by:
getSplitAxis
in interfaceAxisSplitter<P>
-
getPointLength
public int getPointLength()Description copied from interface:AxisSplitter
Number of elements in a point- Specified by:
getPointLength
in interfaceAxisSplitter<P>
-