protected static class BarnesHutTSNE.QuadTree
extends java.lang.Object
This tree stores in every node the number of points contained, the center of mass, and the diagonal of the cell.
Modifier and Type | Field and Description |
---|---|
double[] |
center
Center of mass (NOT center of bounding box)
|
BarnesHutTSNE.QuadTree[] |
children
Child nodes.
|
double[][] |
points
Points stored in this node.
|
double |
squareSize
Square size of this node, for Barnes-Hut approximation.
|
int |
weight
Total weight of this node.
|
Modifier | Constructor and Description |
---|---|
private |
QuadTree(double[][] data,
BarnesHutTSNE.QuadTree[] children,
double[] mid,
int weight,
double squareSize)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static BarnesHutTSNE.QuadTree |
build(int dim,
double[][] data)
Construct the quad tree approximation.
|
private static BarnesHutTSNE.QuadTree |
build(int dim,
double[][] data,
int begin,
int end)
Recursive build function.
|
private static double[] |
computeCenterofMass(int dim,
double[][] data,
int begin,
int end)
Computer the center of mass.
|
private static double[] |
computeExtend(int dim,
double[][] data,
int begin,
int end)
Compute the bounding box of a data set.
|
private static double |
computeSquareSize(double[] minmax)
Compute the square size of a bounding box.
|
private static void |
splitRecursively(double[][] data,
int begin,
int end,
int initdim,
int dims,
double[] minmax,
java.util.ArrayList<double[]> singletons,
java.util.ArrayList<BarnesHutTSNE.QuadTree> children)
Build the quadtree by recursive splitting.
|
java.lang.String |
toString() |
public double[] center
public double[][] points
public double squareSize
public int weight
public BarnesHutTSNE.QuadTree[] children
private QuadTree(double[][] data, BarnesHutTSNE.QuadTree[] children, double[] mid, int weight, double squareSize)
data
- Data pointschildren
- Child nodesmid
- Center of massweight
- Node weightsquareSize
- Square size of the nodepublic static BarnesHutTSNE.QuadTree build(int dim, double[][] data)
dim
- Dimensionalitydata
- Data set (will be modified!)private static BarnesHutTSNE.QuadTree build(int dim, double[][] data, int begin, int end)
dim
- Dimensionalitydata
- Input data (WILL BE MODIFIED)begin
- Subset beginend
- Subset endprivate static void splitRecursively(double[][] data, int begin, int end, int initdim, int dims, double[] minmax, java.util.ArrayList<double[]> singletons, java.util.ArrayList<BarnesHutTSNE.QuadTree> children)
data
- Input databegin
- Subset beginend
- Subset endinitdim
- Current dimensiondims
- Data dimensionalityminmax
- Bounding boxsingletons
- Output for singletonschildren
- Output for child nodesprivate static double[] computeCenterofMass(int dim, double[][] data, int begin, int end)
dim
- Dimensionalitydata
- Data setbegin
- Begin of subsetend
- End of subsetprivate static double[] computeExtend(int dim, double[][] data, int begin, int end)
dim
- Dimensionalitydata
- Data setbegin
- Begin of subsetend
- End of subsetprivate static double computeSquareSize(double[] minmax)
Note that van der Maaten writes "diagonal", while his source code uses the maximum edge length. Barnes and Hut used the cell edge size of a square quad tree.
minmax
- Bounding boxpublic java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2019 ELKI Development Team. License information.