mlpack_approx_kfn(1)
β¨ mlpack_approx_kfn π β the manual page for mlpack_approx_kfn (1), User Commands energy β¨
okay bestie, sit down, hydrate, and let me tell you about approximate furthest neighbor search. this is the mlpack_approx_kfn page and it's lowkey iconic, no cap. π¦
πΈ NAME πΈ
mlpack_approx_kfn β approximate furthest neighbor search. that's it, that's the girl. π
π SYNOPSIS π
mlpack_approx_kfn [-a string] [-e bool] [-x unknown] [-m unknown] [-k int] [-p int] [-t int] [-q unknown] [-r unknown] [-V bool] [-d unknown] [-n unknown] [-M unknown] [-h -v]
she's got flags for days and honestly? we love that for her. π
π« DESCRIPTION π«
so this program implements two whole strategies for furthest neighbor search, and they are, in order:
- the
qdafnalgorithm from "Approximate Furthest Neighbor in High Dimensions" by R. Pagh, F. Silvestri, J. Sivertsen, and M. Skala, in Similarity Search and Applications 2015 (SISAP). - the
DrusillaSelectalgorithm from "Fast approximate furthest neighbors with data-dependent candidate selection", by R.R. Curtin and A.B. Gardner, in Similarity Search and Applications 2016 (SISAP).
these two strategies give approximate results for the furthest neighbor search problem, and you can use them as fast replacements for other furthest neighbor techniques β like the ones chilling over in the mlpack_kfn program. π«Ά and ngl, here's the tea: typically the ds algorithm needs far fewer tables and projections than qdafn. so if you're counting resources, that's a whole vibe check in ds's favor. π
here's how you set it up, bestie:
- reference set (the set to search in)? that's
--reference_file (-r). - query set?
--query_file (-q). - algorithm parameters?
--num_tables (-t)and--num_projections (-p)β or don't, and defaults will be used, we love a flexible queen. - which algorithm?
--algorithm (-a), and you pickdsβ which is the default β orqdafn. - how many neighbors?
--k (-k).
β οΈ important, don't scroll past this: forqdafnin lower dimensions,--num_projections (-p)may need to be set to a high value in order to return results for each query point. that's not a suggestion, that's a requirement, fr fr. π
if you don't specify a query set at all, the reference set itself will be used as the query set. convenient! and the --output_model_file (-M) output parameter can store the built model, while an input model can be loaded instead of specifying a reference set, using the --input_model_file (-m) option. πΎβ¨
results for each query point can be saved with the --neighbors_file (-n) and --distances_file (-d) output parameters. and each row of these output matrices holds the k distances or neighbor indices for each query point. so like, one row per query, k things per row. slay. π
π example time, because we're visual learners π
1. say you wanna find the 5 approximate furthest neighbors, with 'reference_set.csv' as the reference set and 'query_set.csv' as the query set, using DrusillaSelect, and you want to store the furthest neighbor indices to 'neighbors.csv' and the furthest neighbor distances to 'distances.csv'. bestie, you would call:
$ mlpack_approx_kfn --query_file query_set.csv --reference_file reference_set.csv --k 5 --algorithm ds --neighbors_file neighbors.csv --distances_file distances.csv
2. or, to perform approximate all-furthest-neighbors search with k=1 on the set 'data.csv', storing only the furthest neighbor distances to 'distances.csv', you would call:
$ mlpack_approx_kfn --reference_file reference_set.csv --k 1 --distances_file distances.csv
3. and okay, the glow-up moment: a trained model can be re-used. if a model has been previously saved to 'model.bin', then we may find 3 approximate furthest neighbors on a query set 'new_query_set.csv' using that model, and store the furthest neighbor indices into 'neighbors.csv', by calling:
$ mlpack_approx_kfn --input_model_file model.bin --query_file new_query_set.csv --k 3 --neighbors_file neighbors.csv
reuse is the new re-write, periodt. β»οΈ
π OPTIONAL INPUT OPTIONS π
every single one, in order, because we do not skip:
--algorithm (-a)[string] β which algorithm to use:'ds'or'qdafn'. Default value'ds'. π--calculate_error (-e)[bool] β if set, calculate the average distance error for the first furthest neighbor only. just the first one, don't get greedy. π--exact_distances_file (-x)[unknown] β a matrix containing exact distances to furthest neighbors. this can be used to avoid explicit calculation when--calculate_erroris set. efficiency queen. β--help (-h)[bool] β default help info. π--info[string] β print help on a specific option. Default value''.--input_model_file (-m)[unknown] β file containing input model. πΎ--k (-k)[int] β number of furthest neighbors to search for. Default value0.--num_projections (-p)[int] β number of projections to use in each hash table. Default value5.--num_tables (-t)[int] β number of hash tables to use. Default value5.--query_file (-q)[unknown] β matrix containing query points. π--reference_file (-r)[unknown] β matrix containing the reference dataset. π--verbose (-v)[bool] β display informational messages and the full list of parameters and timers at the end of execution. she's chatty and we respect it. π£οΈ--version (-V)[bool] β display the version of mlpack. π
π¦ OPTIONAL OUTPUT OPTIONS π¦
--distances_file (-d)[unknown] β matrix to save furthest neighbor distances to.--neighbors_file (-n)[unknown] β matrix to save neighbor indices to.--output_model_file (-M)[unknown] β file to save output model to.
three little outputs, three little legends. π
π 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. go read, bestie, it's giving scholar behavior. πβ¨
and that's the whole page! this was mlpack-4.8.0, dated 22 June 2026 β shoutout to the mlpack girlies for keeping the docs cute. now go find those furthest neighbors, you absolute main character. π ππΈπ«Ά
π¦ 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