1mlpack_knn(1)               General Commands Manual              mlpack_knn(1)
2
3
4

NAME

6       mlpack_knn - k-nearest-neighbors
7

SYNOPSIS

9        mlpack_knn [-h] [-v]
10

DESCRIPTION

12       This  program will calculate the k-nearest-neighbors of a set of points
13       using kd-trees or cover trees (cover tree support is  experimental  and
14       may  be  slow).  You may specify a separate set of reference points and
15       query points, or just a reference set which will be used  as  both  the
16       reference and query set.
17
18       For  example,  the  following will calculate the 5 nearest neighbors of
19       eachpoint in 'input.csv' and store the distances in 'distances.csv' and
20       the neighbors in the file 'neighbors.csv':
21
22       $  mlpack_knn  --k=5  --reference_file=input.csv  --distances_file=dis‐
23       tances.csv --neighbors_file=neighbors.csv
24
25       The output files are organized such that row i  and  column  j  in  the
26       neighbors output file corresponds to the index of the point in the ref‐
27       erence set which is the i'th nearest neighbor from  the  point  in  the
28       query  set  with  index  j.  Row i and column j in the distances output
29       file corresponds to the distance between those two points.
30

OPTIONAL INPUT OPTIONS

32       --algorithm (-a) [string]
33              Type of neighbor search:  'naive',  'single_tree',  ’dual_tree',
34              'greedy'. Default value ’dual_tree'.
35
36       --epsilon (-e) [double]
37              If  specified,  will do approximate nearest neighbor search with
38              given relative error.  Default value 0.
39
40       --help (-h)
41              Default help info.
42
43       --info [string]
44              Get help on a specific module  or  option.   Default  value  ''.
45              --input_model_file (-m) [string] File containing pre-trained kNN
46              model. Default value ''.
47
48       --k (-k) [int]
49              Number of nearest neighbors to find. Default value 0.
50
51       --leaf_size (-l) [int]
52              Leaf size for tree building (used for kd-trees, vp trees, random
53              projection  trees, UB trees, R trees, R* trees, X trees, Hilbert
54              R trees,  R+  trees,  R++  trees,  spill  trees,  and  octrees).
55              Default value 20.
56
57       --naive (-N)
58              (Deprecated) If true, O(n^2) naive mode is used for computation.
59              Will  be  removed  in  mlpack  3.0.0.  Use  '--algorithm  naive'
60              instead.
61
62       --query_file (-q) [string]
63              File containing query points (optional).  Default value ''.
64
65       --random_basis (-R)
66              Before  tree-building, project the data onto a random orthogonal
67              basis.  --reference_file (-r) [string] File containing the  ref‐
68              erence dataset. Default value ''.
69
70       --rho (-b) [double]
71              Balance  threshold  (only valid for spill trees).  Default value
72              0.7.
73
74       --seed (-s) [int]
75              Random seed (if 0, std::time(NULL) is used).  Default value 0.
76
77       --single_mode (-S)
78              (Deprecated) If true, single-tree search is used (as opposed  to
79              dual-tree search). Will be removed in mlpack 3.0.0. Use '--algo‐
80              rithm single_tree' instead.
81
82       --tau (-u) [double]
83              Overlapping size (only valid for spill trees).  Default value 0.
84
85       --tree_type (-t) [string]
86              Type of tree to use: 'kd', 'vp', 'rp', 'max-rp', ’ub',  'cover',
87              'r',  'r-star',  'x',  'ball',  ’hilbert-r',  'r-plus', 'r-plus-
88              plus',  'spill',  ’oct'.  Default   value   'kd'.    --true_dis‐
89              tances_file  (-D) [string] File of true distances to compute the
90              effective error (average relative error) (it is printed when  -v
91              is  specified).  Default  value  ''.  --true_neighbors_file (-T)
92              [string] File of true neighbors to compute  the  recall  (it  is
93              printed when -v is specified). Default value ’'.
94
95       --verbose (-v)
96              Display  informational  messages and the full list of parameters
97              and timers at the end of execution.
98
99       --version (-V)
100              Display the version of mlpack.
101

OPTIONAL OUTPUT OPTIONS

103       --distances_file (-d) [string] File to output distances  into.  Default
104       value  ’'.   --neighbors_file  (-n)  [string]  File to output neighbors
105       into. Default value ’'.  --output_model_file (-M)  [string]  If  speci‐
106       fied, the kNN model will be saved to the given file. Default value ''.
107

ADDITIONAL INFORMATION

ADDITIONAL INFORMATION

110       For further information, including relevant papers, citations, and the‐
111       ory, For further information, including relevant papers, citations, and
112       theory,  consult  the  documentation  found at http://www.mlpack.org or
113       included   with   your   consult    the    documentation    found    at
114       http://www.mlpack.org  or  included  with  your DISTRIBUTION OF MLPACK.
115       DISTRIBUTION OF MLPACK.
116
117
118
119                                                                 mlpack_knn(1)
Impressum