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