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