mlpack_krann(1)
π mlpack_krann β the k-rank-approximate-nearest-neighbors bestie π
okay so real talk: this is mlpack_krann(1), like, a User Commands situation, and it's literally here to hand you the k rank-approximate-nearest-neighbors of a set of points. yes the name is a whole mouthful, we call her krann for short, she's iconic, she slays π
β¨ SYNOPSIS β¨
mlpack_krann [-a double] [-X bool] [-m unknown] [-k int] [-l int] [-N bool] [-q unknown] [-R bool] [-r unknown] [-L bool] [-s int] [-S bool] [-z int] [-T double] [-t string] [-V bool] [-d unknown] [-n unknown] [-M unknown] [-h -v]
she's giving so many flags and honestly? every single one of them is useful, iykyk π
πΈ DESCRIPTION πΈ
so basically this program computes the k rank-approximate-nearest-neighbors of a set of points. you can either hand her a separate reference set and query set, or you can just give her a reference set and she'll use that as both the reference and the query set. no cap. π¦
and listen β you must tell her the rank approximation (that's in %) and, if you're feeling fancy, the success probability too.
for example, this right here returns 5 neighbors from the top 0.1% of the data (with probability 0.95) for every single point in input.csv, and stashes the distances in distances.csv and the neighbors in neighbors.csv.csv:
$ mlpack_krann --reference_file input.csv --k 5 --distances_file distances.csv --neighbors_file neighbors.csv --tau 0.1
β οΈ okay bestie, important one:tauhas to be set so the number of points in the corresponding percentile of the data is greater thank. like, if you picktau = 0.1on a dataset of1000points withk = 5, you're literally trying to choose 5 nearest neighbors out of the closest 1 point β which is invalid and the program will just terminate with an error message. not it. π
and about the output matrices, they're organized like so: row i and column j in the neighbors output file = the index of the point in the reference set that is the i'th nearest neighbor from the point in the query set with index j. meanwhile row i and column j in the distances output file = the distance between those two points. matching energies, periodt. β¨
π OPTIONAL INPUT OPTIONS π
--alpha,-a[double] β the desired success probability, as in, how confident you wanna be. default value0.95π--first_leaf_exact,-X[bool] β the flag that triggers sampling only after exactly exploring the first leaf. very "wait until we've finished this one thing" of her.--help,-h[bool] β default help info. your girl always comes through π«Ά--info[string] β print help on a specific option. default value''.--input_model_file,-m[unknown] β a pre-trained kNN model. bring your own, she'll take it.--k,-k[int] β number of nearest neighbors to find. default value0.--leaf_size,-l[int] β leaf size for tree building (used for kd-trees, UB trees, R trees, R* trees, X trees, Hilbert R trees, R+ trees, R++ trees, and octrees). default value20. yes bestie, that's a lot of trees, she has range π³β¨--naive,-N[bool] β if true, sampling will be done without using a tree. raw. unbothered. unhinged but valid π--query_file,-q[unknown] β matrix containing query points (optional).--random_basis,-R[bool] β before tree-building, project the data onto a random orthogonal basis. main character transformation arc π--reference_file,-r[unknown] β matrix containing the reference dataset.--sample_at_leaves,-L[bool] β the flag to trigger sampling at leaves. π--seed,-s[int] β random seed (if0,std::time(NULL)is used). default value0. for when you need the vibe to be reproducible.--single_mode,-S[bool] β if true, single-tree search is used (as opposed to dual-tree search.--single_sample_limit,-z[int] β the limit on the maximum number of samples (and hence the largest node you can approximate). default value20.--tau,-T[double] β the allowed rank-error in terms of the percentile of the data. default value5.--tree_type,-t[string] β type of tree to use:'kd','ub','cover','r','x','r-star','hilbert-r','r-plus','r-plus-plus','oct'. default value'kd'. the tree lineup ate and left no crumbs π--verbose,-v[bool] β display informational messages and the full list of parameters and timers at the end of execution. she's a talker and we love that for her π£οΈ--version,-V[bool] β display the version of mlpack.
π OPTIONAL OUTPUT OPTIONS π
--distances_file,-d[unknown] β matrix to output distances into.--neighbors_file,-n[unknown] β matrix to output neighbors into.--output_model_file,-M[unknown] β if specified, the kNN model will be output here. save her for later, bestie π§
π ADDITIONAL INFORMATION π
for further information β and we mean relevant papers, citations, and theory, the whole academic situation β go consult the documentation found at http://www.mlpack.org or the one included with your distribution of mlpack. π
okay and that's the whole page, no notes. this was mlpack_krann, brought to you by mlpack-4.8.0, dated 22 June 2026. go approximate some neighbors bestie, you're gonna do amazing πβ¨π¦π
π¦ where this page comes from
- ubuntu stonking: mlpack-bin 4.8.0-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms