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: tau has to be set so the number of points in the corresponding percentile of the data is greater than k. like, if you pick tau = 0.1 on a dataset of 1000 points with k = 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 value 0.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 value 0.
  • --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 value 20. 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 (if 0, std::time(NULL) is used). default value 0. 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 value 20.
  • --tau, -T [double] β€” the allowed rank-error in terms of the percentile of the data. default value 5.
  • --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