DATATYPE - the primitive array datatype which represents a centroid of this
cluster.@Reference(author={"Y. Cai","W. Tong","L. Yang","A. G. Hauptmann"}, title="Constrained Keypoint Quantization: Towards Better Bag-of-Words Model for Large-scale Multimedia Retrieval", type=Inproceedings, year="2012", booktitle="ACM International Conference on Multimedia Retrieval", customData={"location","Hong Kong, China"}) public class ConstrainedFloatAssigner<DATATYPE> extends Object implements HardAssigner<DATATYPE,float[],IntFloatPair>
Invalid assignments are marked by a cluster id of -1, and (if applicable)
distance of Float.NaN. Users of this class must check the assignments
and filter as necessary.
| Constructor and Description |
|---|
ConstrainedFloatAssigner(HardAssigner<DATATYPE,float[],IntFloatPair> internalAssigner,
float threshold)
Construct the ConstrainedFloatAssigner with the given assigner and
threshold.
|
ConstrainedFloatAssigner(HardAssigner<DATATYPE,float[],IntFloatPair> internalAssigner,
float threshold,
boolean greater)
Construct the ConstrainedFloatAssigner with the given assigner and
threshold.
|
| Modifier and Type | Method and Description |
|---|---|
int |
assign(DATATYPE data)
Assign a single point to a cluster.
|
int[] |
assign(DATATYPE[] data)
Assign data to a cluster.
|
IntFloatPair |
assignDistance(DATATYPE data)
Assign a single point to a cluster.
|
void |
assignDistance(DATATYPE[] data,
int[] indices,
float[] distances)
Assign data to clusters.
|
int |
numDimensions()
Get the number of dimensions of the input vectors.
|
int |
size()
The number of centroids or unique ids that can be generated.
|
public ConstrainedFloatAssigner(HardAssigner<DATATYPE,float[],IntFloatPair> internalAssigner, float threshold)
internalAssigner - the internal assigner for computing distances.threshold - the threshold at which assignments are rejected.public ConstrainedFloatAssigner(HardAssigner<DATATYPE,float[],IntFloatPair> internalAssigner, float threshold, boolean greater)
internalAssigner - the internal assigner for computing distances.threshold - the threshold at which assignments are rejected.greater - if true distances less than the threshold are rejected; if
false then distances greater than the threshold are rejected.public int[] assign(DATATYPE[] data)
HardAssignerassign in interface HardAssigner<DATATYPE,float[],IntFloatPair>data - the data.public int assign(DATATYPE data)
HardAssignerassign in interface HardAssigner<DATATYPE,float[],IntFloatPair>data - datum to assign.public void assignDistance(DATATYPE[] data, int[] indices, float[] distances)
HardAssignerassignDistance in interface HardAssigner<DATATYPE,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(DATATYPE data)
HardAssignerassignDistance in interface HardAssigner<DATATYPE,float[],IntFloatPair>data - point to assign.public int size()
HardAssignersize in interface HardAssigner<DATATYPE,float[],IntFloatPair>public int numDimensions()
AssignernumDimensions in interface Assigner<DATATYPE>