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