mlpack
|
#include <mlpack/prereqs.hpp>
#include <mlpack/core/util/io.hpp>
#include <mlpack/core/util/mlpack_main.hpp>
#include <mlpack/core/metrics/lmetric.hpp>
#include "lsh_search.hpp"
Functions | |
BINDING_NAME ("K-Approximate-Nearest-Neighbor Search with LSH") | |
BINDING_SHORT_DESC ("An implementation of approximate k-nearest-neighbor search with " "locality-sensitive hashing (LSH). Given a set of reference points and a " "set of query points, this will compute the k approximate nearest neighbors" " of each query point in the reference set; models can be saved for future " "use.") | |
BINDING_LONG_DESC ("This program will calculate the k approximate-nearest-neighbors of a set " "of points using locality-sensitive hashing. You may specify a separate set" " of reference points and query points, or just a reference set which will " "be used as both the reference and query set. ") | |
BINDING_EXAMPLE ("For example, the following will return 5 neighbors from the data for each " "point in "+PRINT_DATASET("input")+" and store the distances in "+PRINT_DATASET("distances")+" and the neighbors in "+PRINT_DATASET("neighbors")+":" "\"+PRINT_CALL("lsh", "k", 5, "reference", "input", "distances", "distances", "neighbors", "neighbors")+"\" "The output is organized such that 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. Row j and column i in the distances output file corresponds to the " "distance between those two points." "\" "Because this is approximate-nearest-neighbors search, results may be " "different from run to run. Thus, the "+PRINT_PARAM_STRING("seed")+" parameter can be specified to set the random seed." "\" "This program also has many other parameters to control its functionality;" " see the parameter-specific documentation for more information.") | |
BINDING_SEE_ALSO ("@knn", "#knn") | |
BINDING_SEE_ALSO ("@krann", "#krann") | |
BINDING_SEE_ALSO ("Locality-sensitive hashing on Wikipedia", "https://en.wikipedia.org/wiki/Locality-sensitive_hashing") | |
BINDING_SEE_ALSO ("Locality-sensitive hashing scheme based on p-stable" " distributions(pdf)", "http://mlpack.org/papers/lsh.pdf") | |
BINDING_SEE_ALSO ("mlpack::neighbor::LSHSearch C++ class documentation", "@doxygen/classmlpack_1_1neighbor_1_1LSHSearch.html") | |
PARAM_MATRIX_IN ("reference", "Matrix containing the reference dataset.", "r") | |
PARAM_MATRIX_OUT ("distances", "Matrix to output distances into.", "d") | |
PARAM_UMATRIX_OUT ("neighbors", "Matrix to output neighbors into.", "n") | |
PARAM_MODEL_IN (LSHSearch<>, "input_model", "Input LSH model.", "m") | |
PARAM_MODEL_OUT (LSHSearch<>, "output_model", "Output for trained LSH model.", "M") | |
PARAM_UMATRIX_IN ("true_neighbors", "Matrix of true neighbors to compute " "recall with (the recall is printed when -v is specified).", "t") | |
PARAM_INT_IN ("k", "Number of nearest neighbors to find.", "k", 0) | |
PARAM_MATRIX_IN ("query", "Matrix containing query points (optional).", "q") | |
PARAM_INT_IN ("projections", "The number of hash functions for each table", "K", 10) | |
PARAM_INT_IN ("tables", "The number of hash tables to be used.", "L", 30) | |
PARAM_DOUBLE_IN ("hash_width", "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.", "H", 0.0) | |
PARAM_INT_IN ("num_probes", "Number of additional probes for multiprobe LSH; if " "0, traditional LSH is used.", "T", 0) | |
PARAM_INT_IN ("second_hash_size", "The size of the second level hash table.", "S", 99901) | |
PARAM_INT_IN ("bucket_size", "The size of a bucket in the second level hash.", "B", 500) | |
PARAM_INT_IN ("seed", "Random seed. If 0, 'std::time(NULL)' is used.", "s", 0) | |
This file computes the approximate nearest-neighbors using 2-stable Locality-sensitive Hashing.
mlpack is free software; you may redistribute it and/or modify it under the terms of the 3-clause BSD license. You should have received a copy of the 3-clause BSD license along with mlpack. If not, see http://www.opensource.org/licenses/BSD-3-Clause for more information.