|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectbijnum.BIJknn
public class BIJknn
k Nearest Neighborhood (brute-force) implementation. You can create a kNN object, add datasets to it, and classify vectors. Copyright (c) 1999-2003, Michael Abramoff. All rights reserved.
| Field Summary | |
|---|---|
float[] |
classset
The corresponding classification for each vector in the dataset, a 1xM vector. |
float[][] |
dataset
The dataset, a MxN matrix of N-dimensional vectors. |
static int |
inserts
|
int |
n
The number of different classes in classset. |
| Constructor Summary | |
|---|---|
BIJknn(float[][] dataset,
float[] classset,
int n)
|
|
BIJknn(int n)
|
|
| Method Summary | |
|---|---|
void |
add(float[][] extradataset,
float[] extraclassset)
Add extra data and classification to this knn. |
float[] |
classify(float[][] unknown,
int k)
Find the classification of M (N dimensional) vectors unknown in the dataset. |
void |
prune(int k)
Cleans the dataset using Wilson's pruning algorithm. |
void |
search(int[] kIndices,
float[] kDistances,
float[] v,
int k)
Find the k-nearest neighbors of vector v (N dimensional) in dataset and put indices in kIndices, distances in kDistances. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public float[][] dataset
public float[] classset
public int n
public static int inserts
| Constructor Detail |
|---|
public BIJknn(int n)
public BIJknn(float[][] dataset,
float[] classset,
int n)
| Method Detail |
|---|
public void add(float[][] extradataset,
float[] extraclassset)
throws java.lang.Exception
extradataset - an extra datasetextraclassset - an extra class set.
java.lang.Exception
public float[] classify(float[][] unknown,
int k)
unknown - a MxN matrix of M vectors to be classified in the dataset.k - the number of neighbors to use for classification
public void search(int[] kIndices,
float[] kDistances,
float[] v,
int k)
kIndices - a int[] of length k that will contain the indices to the k closest neighbors of vkDistances - a float[] of length k that will contain the distances to the k closest neighbors of v.v - the vector to classifyk - the number of neighbors to use for classificationpublic void prune(int k)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||