public class ByteKNNAssigner extends Object implements SoftAssigner<byte[],float[]>
SoftAssigner that picks a fixed number of nearest neighbours.
Weights returned are actually the distances to the centroids.| Modifier and Type | Field and Description |
|---|---|
protected ByteNearestNeighbours |
nn |
protected int |
numNeighbours |
| Constructor and Description |
|---|
ByteKNNAssigner(byte[][] data,
boolean exact,
int numNeighbours)
Construct the assigner using the given cluster data.
|
ByteKNNAssigner(byte[][] data,
ByteFVComparison comparison,
int numNeighbours)
Construct the assigner using the given cluster data and
distance function.
|
ByteKNNAssigner(CentroidsProvider<byte[]> provider,
boolean exact,
int numNeighbours)
Construct the assigner using the given cluster data.
|
ByteKNNAssigner(CentroidsProvider<byte[]> provider,
ByteFVComparison comparison,
int numNeighbours)
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 some clusters.
|
int[][] |
assign(byte[][] data)
Assign data to clusters.
|
IndependentPair<int[],float[]> |
assignWeighted(byte[] data)
Assign a single point to some clusters.
|
void |
assignWeighted(byte[][] data,
int[][] assignments,
float[][] weights)
Assign data to clusters.
|
int |
numDimensions()
Get the number of dimensions of the input vectors.
|
int |
size()
The number of clusters.
|
protected ByteNearestNeighbours nn
protected int numNeighbours
public ByteKNNAssigner(CentroidsProvider<byte[]> provider, boolean exact, int numNeighbours)
ByteNearestNeighboursExact or
ByteNearestNeighboursKDTree, depending on whether the exact
parameter is true or false. If the parameter is true, then the
resultant ByteNearestNeighboursExact will use Euclidean
distance.provider - the cluster data providerexact - if true, then use exact mode; false implies approximate mode.numNeighbours - the number of nearest neighbours to select.public ByteKNNAssigner(byte[][] data, boolean exact, int numNeighbours)
ByteNearestNeighboursExact or
ByteNearestNeighboursKDTree, depending on whether the exact
parameter is true or false. If the parameter is true, then the
resultant ByteNearestNeighboursExact will use Euclidean
distance.data - the cluster dataexact - if true, then use exact mode; false implies approximate mode.numNeighbours - the number of nearest neighbours to select.public ByteKNNAssigner(CentroidsProvider<byte[]> provider, ByteFVComparison comparison, int numNeighbours)
ByteNearestNeighboursExact.provider - the cluster data providercomparison - the distance functionnumNeighbours - the number of nearest neighbours to select.public ByteKNNAssigner(byte[][] data, ByteFVComparison comparison, int numNeighbours)
ByteNearestNeighboursExact.data - the cluster datacomparison - the distance functionnumNeighbours - the number of nearest neighbours to select.public int[][] assign(byte[][] data)
SoftAssignerassign in interface SoftAssigner<byte[],float[]>data - the data.public int[] assign(byte[] data)
SoftAssignerassign in interface SoftAssigner<byte[],float[]>data - datum to assign.public void assignWeighted(byte[][] data, int[][] assignments, float[][] weights)
SoftAssignerassignWeighted in interface SoftAssigner<byte[],float[]>data - the data.assignments - the cluster indices for each data point.weights - the weights to the for each cluster for each data point.public IndependentPair<int[],float[]> assignWeighted(byte[] data)
SoftAssignerassignWeighted in interface SoftAssigner<byte[],float[]>data - point to assign.public int numDimensions()
AssignernumDimensions in interface Assigner<byte[]>public int size()
SoftAssignersize in interface SoftAssigner<byte[],float[]>