public class FloatKNNAssigner extends Object implements SoftAssigner<float[],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 FloatNearestNeighbours |
nn |
protected int |
numNeighbours |
| Constructor and Description |
|---|
FloatKNNAssigner(CentroidsProvider<float[]> provider,
boolean exact,
int numNeighbours)
Construct the assigner using the given cluster data.
|
FloatKNNAssigner(CentroidsProvider<float[]> provider,
FloatFVComparison comparison,
int numNeighbours)
Construct the assigner using the given cluster data and
distance function.
|
FloatKNNAssigner(float[][] data,
boolean exact,
int numNeighbours)
Construct the assigner using the given cluster data.
|
FloatKNNAssigner(float[][] data,
FloatFVComparison comparison,
int numNeighbours)
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 some clusters.
|
int[][] |
assign(float[][] data)
Assign data to clusters.
|
IndependentPair<int[],float[]> |
assignWeighted(float[] data)
Assign a single point to some clusters.
|
void |
assignWeighted(float[][] 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 FloatNearestNeighbours nn
protected int numNeighbours
public FloatKNNAssigner(CentroidsProvider<float[]> provider, boolean exact, int numNeighbours)
FloatNearestNeighboursExact or
FloatNearestNeighboursKDTree, depending on whether the exact
parameter is true or false. If the parameter is true, then the
resultant FloatNearestNeighboursExact 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 FloatKNNAssigner(float[][] data, boolean exact, int numNeighbours)
FloatNearestNeighboursExact or
FloatNearestNeighboursKDTree, depending on whether the exact
parameter is true or false. If the parameter is true, then the
resultant FloatNearestNeighboursExact 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 FloatKNNAssigner(CentroidsProvider<float[]> provider, FloatFVComparison comparison, int numNeighbours)
FloatNearestNeighboursExact.provider - the cluster data providercomparison - the distance functionnumNeighbours - the number of nearest neighbours to select.public FloatKNNAssigner(float[][] data, FloatFVComparison comparison, int numNeighbours)
FloatNearestNeighboursExact.data - the cluster datacomparison - the distance functionnumNeighbours - the number of nearest neighbours to select.public int[][] assign(float[][] data)
SoftAssignerassign in interface SoftAssigner<float[],float[]>data - the data.public int[] assign(float[] data)
SoftAssignerassign in interface SoftAssigner<float[],float[]>data - datum to assign.public void assignWeighted(float[][] data, int[][] assignments, float[][] weights)
SoftAssignerassignWeighted in interface SoftAssigner<float[],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(float[] data)
SoftAssignerassignWeighted in interface SoftAssigner<float[],float[]>data - point to assign.public int numDimensions()
AssignernumDimensions in interface Assigner<float[]>public int size()
SoftAssignersize in interface SoftAssigner<float[],float[]>