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 qdafn algorithm 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 DrusillaSelect algorithm 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 pick ds β€” which is the default β€” or qdafn.
  • how many neighbors? --k (-k).
⚠️ important, don't scroll past this: for qdafn in 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_error is 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 value 0.
  • --num_projections (-p) [int] β€” number of projections to use in each hash table. Default value 5.
  • --num_tables (-t) [int] β€” number of hash tables to use. Default value 5.
  • --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