public class ExactFloatAssigner extends Object implements HardAssigner<float[],float[],IntFloatPair>
HardAssigner
that assigns points to the closest
cluster based on the distance to the centroid.Modifier and Type | Field and Description |
---|---|
protected FloatNearestNeighboursExact |
nn |
Constructor and Description |
---|
ExactFloatAssigner(CentroidsProvider<float[]> provider)
Construct the assigner using the given cluster data.
|
ExactFloatAssigner(CentroidsProvider<float[]> provider,
FloatFVComparator comparison)
Construct the assigner using the given cluster data and
distance function.
|
ExactFloatAssigner(float[][] data,
FloatFVComparator comparison)
Construct the assigner using the given cluster data and
distance function.
|
Modifier and Type | Method and Description |
---|---|
int |
assign(float[] data)
Assign a single point to a cluster.
|
int[] |
assign(float[][] data)
Assign data to a cluster.
|
IntFloatPair |
assignDistance(float[] data)
Assign a single point to a cluster.
|
void |
assignDistance(float[][] data,
int[] indices,
float[] distances)
Assign data to clusters.
|
FloatNearestNeighboursExact |
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 FloatNearestNeighboursExact nn
public ExactFloatAssigner(CentroidsProvider<float[]> provider)
provider
- the cluster data providerpublic ExactFloatAssigner(CentroidsProvider<float[]> provider, FloatFVComparator comparison)
provider
- the cluster data providercomparison
- the distance functionpublic ExactFloatAssigner(float[][] data, FloatFVComparator comparison)
data
- the cluster datacomparison
- the distance functionpublic int[] assign(float[][] data)
HardAssigner
assign
in interface HardAssigner<float[],float[],IntFloatPair>
data
- the data.public int assign(float[] data)
HardAssigner
assign
in interface HardAssigner<float[],float[],IntFloatPair>
data
- datum to assign.public void assignDistance(float[][] data, int[] indices, float[] distances)
HardAssigner
assignDistance
in interface HardAssigner<float[],float[],IntFloatPair>
data
- the data.indices
- the cluster index for each data point.distances
- the distance to the closest cluster for each data point.public IntFloatPair assignDistance(float[] data)
HardAssigner
assignDistance
in interface HardAssigner<float[],float[],IntFloatPair>
data
- point to assign.public int size()
HardAssigner
size
in interface HardAssigner<float[],float[],IntFloatPair>
public int numDimensions()
Assigner
numDimensions
in interface Assigner<float[]>
public FloatNearestNeighboursExact getNN()