public class ExactDoubleAssigner extends Object implements HardAssigner<double[],double[],IntDoublePair>
HardAssigner
that assigns points to the closest
cluster based on the distance to the centroid.Modifier and Type | Field and Description |
---|---|
protected DoubleNearestNeighboursExact |
nn |
Constructor and Description |
---|
ExactDoubleAssigner(CentroidsProvider<double[]> provider)
Construct the assigner using the given cluster data.
|
ExactDoubleAssigner(CentroidsProvider<double[]> provider,
DoubleFVComparator comparison)
Construct the assigner using the given cluster data and
distance function.
|
ExactDoubleAssigner(double[][] data,
DoubleFVComparator comparison)
Construct the assigner using the given cluster data and
distance function.
|
Modifier and Type | Method and Description |
---|---|
int |
assign(double[] data)
Assign a single point to a cluster.
|
int[] |
assign(double[][] data)
Assign data to a cluster.
|
IntDoublePair |
assignDistance(double[] data)
Assign a single point to a cluster.
|
void |
assignDistance(double[][] data,
int[] indices,
double[] distances)
Assign data to clusters.
|
DoubleNearestNeighboursExact |
getNN()
Get the underlying nearest-neighbour implementation.
|
int |
numDimensions()
Get the number of dimensions of the input vectors.
|
int |
size()
The number of centroids or unique ids that can be generated.
|
protected DoubleNearestNeighboursExact nn
public ExactDoubleAssigner(CentroidsProvider<double[]> provider)
provider
- the cluster data providerpublic ExactDoubleAssigner(CentroidsProvider<double[]> provider, DoubleFVComparator comparison)
provider
- the cluster data providercomparison
- the distance functionpublic ExactDoubleAssigner(double[][] data, DoubleFVComparator comparison)
data
- the cluster datacomparison
- the distance functionpublic int[] assign(double[][] data)
HardAssigner
assign
in interface HardAssigner<double[],double[],IntDoublePair>
data
- the data.public int assign(double[] data)
HardAssigner
assign
in interface HardAssigner<double[],double[],IntDoublePair>
data
- datum to assign.public void assignDistance(double[][] data, int[] indices, double[] distances)
HardAssigner
assignDistance
in interface HardAssigner<double[],double[],IntDoublePair>
data
- the data.indices
- the cluster index for each data point.distances
- the distance to the closest cluster for each data point.public IntDoublePair assignDistance(double[] data)
HardAssigner
assignDistance
in interface HardAssigner<double[],double[],IntDoublePair>
data
- point to assign.public int size()
HardAssigner
size
in interface HardAssigner<double[],double[],IntDoublePair>
public int numDimensions()
Assigner
numDimensions
in interface Assigner<double[]>
public DoubleNearestNeighboursExact getNN()