MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / DANN

Class DANN

JSAT/src/jsat/classifiers/knn/DANN.java:42–462  ·  view source on GitHub ↗

DANN is an implementation of Discriminant Adaptive Nearest Neighbor. DANN has a fixed O(n) classification time. At each classification, DANN uses a large set of points to iteratively create and adjust a distance metic that reflects the separability of classes at a localized level. This increa

Source from the content-addressed store, hash-verified

40 * @author Edward Raff
41 */
42public class DANN implements Classifier, Parameterized
43{
44
45 private static final long serialVersionUID = -272865942127664672L;
46 /**
47 * The default number of neighbors to use when building a metric is
48 * {@value #DEFAULT_KN}.
49 */
50 public static final int DEFAULT_KN = 40;
51 /**
52 * The default number of neighbors to use when classifying is
53 * {@value #DEFAULT_K}
54 */
55 public static final int DEFAULT_K = 1;
56 /**
57 * The default regularization used when building a metric is
58 * {@value #DEFAULT_EPS}
59 */
60 public static final double DEFAULT_EPS = 1.0;
61 /**
62 * The default number of iterations for creating the metric is
63 * {@value #DEFAULT_ITERATIONS}
64 */
65 public static final int DEFAULT_ITERATIONS = 1;
66
67 private int kn;
68 private int k;
69 private int maxIterations;
70 private double eps;
71
72 private VectorCollectionFactory<VecPaired<Vec, Integer>> vcf;
73
74 private CategoricalData predicting;
75
76 /**
77 * Vectors paired with their index in the original data set
78 */
79 private VectorCollection<VecPaired<Vec, Integer>> vc;
80 private List<VecPaired<Vec, Integer>> vecList;
81
82 /**
83 * Creates a new DANN classifier
84 */
85 public DANN()
86 {
87 this(DEFAULT_KN, DEFAULT_K);
88 }
89
90 /**
91 * Creates a new DANN classifier
92 * @param kn the number of neighbors to use in casting a net to build a new metric
93 * @param k the number of neighbors to use with the final metric in classification
94 */
95 public DANN(int kn, int k)
96 {
97 this(kn, k, DEFAULT_EPS);
98 }
99

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected