mlpack_lsh(1)
π NAME π
mlpack_lsh β ok so bestie, this is the k-approximate-nearest-neighbor search tool, but with locality-sensitive hashing doing all the heavy lifting. Periodt.
This is a page from the mlpack manual, section 1 (User Commands). π
β¨ SYNOPSIS β¨
mlpack_lsh [-B int] [-H double] [-m unknown] [-k int] [-T int] [-K int] [-q unknown] [-r unknown] [-S int] [-s int] [-L int] [-t unknown] [-V bool] [-d unknown] [-n unknown] [-M unknown] [-h -v]
Not me showing you the whole flag lineup right off the bat π every single one gets explained down below, don't even worry.
π¦ DESCRIPTION π¦
So basically, this program calculates the k approximate-nearest-neighbors of a set of points using locality-sensitive hashing. You can hand it a separate reference set and a query set, or you can just give it a reference set and it'll use that same set as both the reference and the query. Iconic, flexible, we love her. π
For example, the following will return 5 neighbors from the data for each point in input.csv and store the distances in distances.csv and the neighbors in neighbors.csv:
$ mlpack_lsh --k 5 --reference_file input.csv --distances_file distances.csv --neighbors_file neighbors.csv
Now, the output is organized a very specific way, so listen up because this is the part everyone gets wrong π Row i and column j in the neighbors output corresponds to the index of the point in the reference set which is the j'th nearest neighbor from the point in the query set with index i. And row j and column i in the distances output file corresponds to the distance between those two points. Same two points, indexed two ways β that's the whole bit. π
Heads up bestie π because this is approximate-nearest-neighbors search, results may be different from run to run. It's not broken, it's just like that. So if you want it reproducible, the --seed (-s) parameter can be specified to set the random seed. Do it. Please. For me. π«Ά
This program also has many other parameters to control its functionality; see the parameter-specific documentation for more information. Go off, customise your whole life.
πΈ OPTIONAL INPUT OPTIONS πΈ
--bucket_size (-B)[int]β the size of a bucket in the second level hash. Default value500.--hash_width (-H)[double]β the hash width for the first-level hashing in the LSH preprocessing. By default, the LSH class automatically estimates a hash width for its use. Default value0.--help (-h)[bool]β default help info. Your classic "help me bestie" button.--info[string]β print help on a specific option. Default value''. Very targeted, very main character.--input_model_file (-m)[unknown]β input LSH model. Load up that pre-trained glow β¨--k (-k)[int]β number of nearest neighbors to find. Default value0.--num_probes (-T)[int]β number of additional probes for multiprobe LSH; if0, traditional LSH is used. Default value0.--projections (-K)[int]β the number of hash functions for each table. Default value10.--query_file (-q)[unknown]β matrix containing query points (optional). It's optional, she's chill like that.--reference_file (-r)[unknown]β matrix containing the reference dataset.--second_hash_size (-S)[int]β the size of the second level hash table. Default value99901.--seed (-s)[int]β random seed. If0,'std::time(NULL)'is used. Default value0.--tables (-L)[int]β the number of hash tables to be used. Default value30.--true_neighbors_file (-t)[unknown]β matrix of true neighbors to compute recall with (the recall is printed when-vis specified). Okay so this is literally the "how did we do compared to the truth" file. π―--verbose (-v)[bool]β display informational messages and the full list of parameters and timers at the end of execution.--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]β output for trained LSH model. Save your progress, queen. π
π ADDITIONAL INFORMATION π
For further information, including relevant papers, citations, and theory, consult the documentation found at http://www.mlpack.org or included with your distribution of mlpack. The lore is out there, iykyk. π
And that's the whole page, bestie β slay. This masterpiece is from mlpack-4.8.0, dated 22 June 2026, and it's the mlpack_lsh(1) manual page. Love her, use her, go find some neighbors. π¦β¨π
π¦ 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