classifier
Class ANN

java.lang.Object
  extended by classifier.ANN

public class ANN
extends java.lang.Object

API for interface to ANN (Approximate Nearest Neighbor) classification. Copyright (c) 1999-2004, Michael Abramoff. All rights reserved.


Constructor Summary
ANN()
           
 
Method Summary
static int annkEstimates(float[] classes, float[][] querypts, int k, int nrclasses, double epsilon, float[] estimates)
           
static int annkPriSearch(float[] querypt, int k, int[] indices, float[] distances, double epsilon)
           
static int bdtree(float[][] datapts)
           
static float[] estimate(float[][] querypts, float[] trueclasses, int k, int nrclasses, double epsilon)
          Determine the ANN classification for an array of feature vectors.
static int getvote(float[] classes, int nrclasses)
           
static float[] kdhard(float[][] pts, float[] trueclasses, int nrclasses, int k, double epsilon)
          Do a hard kd-tree knn classification.
static int kdhard(float[] classes, double[] matrix, int nelements, int k, int nrclasses, double epsilon, int[] estimates)
           
static float[][] kdsoft(float[][] pts, float[] trueclasses, int nrclasses, int k, double epsilon)
          Determine the ANN soft classification for an array of feature vectors.
static int kdsoft(float[] classes, double[] matrix, int nelements, int k, int nrclasses, double epsilon, float[][] probs)
           
static int kdtree(float[][] datapts)
           
static java.lang.String version()
          Train a ANN classifier (bd_tree).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ANN

public ANN()
Method Detail

version

public static java.lang.String version()
Train a ANN classifier (bd_tree).


bdtree

public static int bdtree(float[][] datapts)

kdtree

public static int kdtree(float[][] datapts)

getvote

public static int getvote(float[] classes,
                          int nrclasses)

annkPriSearch

public static int annkPriSearch(float[] querypt,
                                int k,
                                int[] indices,
                                float[] distances,
                                double epsilon)

kdhard

public static int kdhard(float[] classes,
                         double[] matrix,
                         int nelements,
                         int k,
                         int nrclasses,
                         double epsilon,
                         int[] estimates)

kdsoft

public static int kdsoft(float[] classes,
                         double[] matrix,
                         int nelements,
                         int k,
                         int nrclasses,
                         double epsilon,
                         float[][] probs)

annkEstimates

public static int annkEstimates(float[] classes,
                                float[][] querypts,
                                int k,
                                int nrclasses,
                                double epsilon,
                                float[] estimates)

estimate

public static float[] estimate(float[][] querypts,
                               float[] trueclasses,
                               int k,
                               int nrclasses,
                               double epsilon)
                        throws java.lang.Exception
Determine the ANN classification for an array of feature vectors. The classification for the ANN tree is in trueclasses.

Parameters:
querypts - float[][] the points to be queried as a vector of vectors.
trueclasses - float[] the true classification for the current ANN training set (not for the querypts!)
nrclasses - int the number of classes occuring in trueclasses
k - int the numbe rof neighbors to consult.
epsilon - double error term.
Returns:
float[] the estimates for each entry in querypts[].
Throws:
java.lang.Exception

kdsoft

public static float[][] kdsoft(float[][] pts,
                               float[] trueclasses,
                               int nrclasses,
                               int k,
                               double epsilon)
                        throws java.lang.Exception
Determine the ANN soft classification for an array of feature vectors. The reference standard classification for the ANN tree is in trueclasses.

Parameters:
pts - the point vectors to be queried, where ps[i][j] is the jth element of the feature vector i.
trueclasses - the true classification for the current ANN training set (not for the querypts!)
Returns:
the estimates for all classes for each of the querypts, i.e. probs[j][i] is the probability of pts[j] being class [i]
Throws:
java.lang.Exception

kdhard

public static float[] kdhard(float[][] pts,
                             float[] trueclasses,
                             int nrclasses,
                             int k,
                             double epsilon)
                      throws java.lang.Exception
Do a hard kd-tree knn classification.

Throws:
java.lang.Exception