public class HierarchicalDoubleKMeansResult extends Object implements SpatialClusters<double[]>
HierarchicalDoubleKMeans
clustering operation.Modifier and Type | Class and Description |
---|---|
static class |
HierarchicalDoubleKMeansResult.Node
HierarchicalDoubleKMeans tree node
The number of children is not bigger than the HierarchicalDoubleKMeans K parameter
|
CLUSTER_HEADER
Modifier | Constructor and Description |
---|---|
protected |
HierarchicalDoubleKMeansResult() |
Modifier and Type | Method and Description |
---|---|
String |
asciiHeader()
Header for ascii input.
|
byte[] |
binaryHeader()
Header for binary input.
|
int |
countActiveLeafNodes()
Count number of active leaf nodes.
|
int |
countLeafs()
Total number of leaves assuming leaves = K^depth
|
HierarchicalDoubleHardAssigner |
defaultHardAssigner()
Get the default hard assigner for this clusterer.
|
boolean |
equals(Object o) |
double[] |
getClusterCentroid(int[] path)
Given a path, get the cluster centroid associated with the cluster index of the path.
|
int |
getDepth()
Get the depth of the cluster tree
|
int |
getIndex(int[] path)
Translates a path down the KDTree as a cluster index.
|
static int |
getIndex(int[] path,
int depth,
int K)
Translates a path down the KDTree as a cluster index.
|
int |
getK()
Get the number of clusters per node
|
int[] |
getPath(int index)
Given an index, what was the path down the hierarchy that lead to it.
|
static int[] |
getPath(int index,
int depth,
int K)
Given an index, what was the path down the hierarchy that lead to it.
|
HierarchicalDoubleKMeansResult.Node |
getRoot()
Get the root node of the tree
|
int |
numClusters()
Get the number of clusters.
|
int |
numDimensions()
Get the data dimensionality
|
void |
readASCII(Scanner reader)
Read internal state from in.
|
void |
readBinary(DataInput dis)
Read internal state from in.
|
String |
toString() |
void |
writeASCII(PrintWriter writer)
Write the content of this as ascii to out.
|
void |
writeBinary(DataOutput dos)
Write the content of this as binary to out.
|
protected HierarchicalDoubleKMeansResult()
public int numDimensions()
SpatialClusters
numDimensions
in interface SpatialClusters<double[]>
public int getK()
public int getDepth()
public HierarchicalDoubleKMeansResult.Node getRoot()
public static int getIndex(int[] path, int depth, int K)
path
- depth
- K
- public int getIndex(int[] path)
path
- public static int[] getPath(int index, int depth, int K)
index
- depth
- K
- public int[] getPath(int index)
index
- public int countActiveLeafNodes()
public int countLeafs()
public int numClusters()
SpatialClusters
numClusters
in interface SpatialClusters<double[]>
public double[] getClusterCentroid(int[] path)
path
- public String asciiHeader()
ReadableASCII
asciiHeader
in interface ReadableASCII
asciiHeader
in interface WriteableASCII
public byte[] binaryHeader()
ReadableBinary
binaryHeader
in interface ReadableBinary
binaryHeader
in interface WriteableBinary
public void readASCII(Scanner reader) throws IOException
ReadableASCII
readASCII
in interface ReadableASCII
reader
- source to read from.IOException
- an error reading inputpublic void readBinary(DataInput dis) throws IOException
ReadableBinary
readBinary
in interface ReadableBinary
dis
- source to read from.IOException
- an error reading inputpublic void writeASCII(PrintWriter writer) throws IOException
WriteableASCII
writeASCII
in interface WriteableASCII
writer
- sink to write toIOException
- an error writing to outpublic void writeBinary(DataOutput dos) throws IOException
WriteableBinary
writeBinary
in interface WriteableBinary
dos
- sink to write toIOException
- an error writing to outpublic HierarchicalDoubleHardAssigner defaultHardAssigner()
SpatialClusters
defaultHardAssigner
in interface SpatialClusters<double[]>