mlpack
|
#include <mlpack/prereqs.hpp>
#include <mlpack/core/util/io.hpp>
#include <mlpack/core/util/mlpack_main.hpp>
#include <string>
#include <fstream>
#include <iostream>
#include "neighbor_search.hpp"
#include "unmap.hpp"
#include "ns_model.hpp"
Typedefs | |
typedef NSModel< FurthestNS > | KFNModel |
Functions | |
BINDING_NAME ("k-Furthest-Neighbors Search") | |
BINDING_SHORT_DESC ("An implementation of k-furthest-neighbor search using single-tree and " "dual-tree algorithms. Given a set of reference points and query points, " "this can find the k furthest neighbors in the reference set of each query" " point using trees; trees that are built can be saved for future use.") | |
BINDING_LONG_DESC ("This program will calculate the k-furthest-neighbors of a set of " "points. 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 calculate the 5 furthest neighbors of each" "point in "+PRINT_DATASET("input")+" and store the distances in "+PRINT_DATASET("distances")+" and the neighbors in "+PRINT_DATASET("neighbors")+": " "\"+PRINT_CALL("kfn", "k", 5, "reference", "input", "distances", "distances", "neighbors", "neighbors")+"\" "The output files are organized such that row i and column j in the " "neighbors output matrix corresponds to the index of the point in the " "reference set which is the j'th furthest neighbor from the point in the " "query set with index i. Row i and column j in the distances output file " "corresponds to the distance between those two points.") | |
BINDING_SEE_ALSO ("@approx_kfn", "#approx_kfn") | |
BINDING_SEE_ALSO ("@knn", "#knn") | |
BINDING_SEE_ALSO ("Tree-independent dual-tree algorithms (pdf)", "http://proceedings.mlr.press/v28/curtin13.pdf") | |
BINDING_SEE_ALSO ("mlpack::neighbor::NeighborSearch C++ class documentation", "@doxygen/classmlpack_1_1neighbor_1_1NeighborSearch.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_MATRIX_IN ("true_distances", "Matrix of true distances to compute " "the effective error (average relative error) (it is printed when -v is " "specified).", "D") | |
PARAM_UMATRIX_IN ("true_neighbors", "Matrix of true neighbors to compute the " "recall (it is printed when -v is specified).", "T") | |
PARAM_MODEL_IN (KFNModel, "input_model", "Pre-trained kFN model.", "m") | |
PARAM_MODEL_OUT (KFNModel, "output_model", "If specified, the kFN model will be " "output here.", "M") | |
PARAM_MATRIX_IN ("query", "Matrix containing query points (optional).", "q") | |
PARAM_INT_IN ("k", "Number of furthest neighbors to find.", "k", 0) | |
PARAM_STRING_IN ("tree_type", "Type of tree to use: 'kd', 'vp', 'rp', 'max-rp', " "'ub', 'cover', 'r', 'r-star', 'x', 'ball', 'hilbert-r', 'r-plus', " "'r-plus-plus', 'oct'.", "t", "kd") | |
PARAM_INT_IN ("leaf_size", "Leaf size for tree building (used for kd-trees, " "vp trees, random projection trees, UB trees, R trees, R* trees, X trees, " "Hilbert R trees, R+ trees, R++ trees, and octrees).", "l", 20) | |
PARAM_FLAG ("random_basis", "Before tree-building, project the data onto a " "random orthogonal basis.", "R") | |
PARAM_INT_IN ("seed", "Random seed (if 0, std::time(NULL) is used).", "s", 0) | |
PARAM_STRING_IN ("algorithm", "Type of neighbor search: 'naive', 'single_tree', " "'dual_tree', 'greedy'.", "a", "dual_tree") | |
PARAM_DOUBLE_IN ("epsilon", "If specified, will do approximate furthest neighbor" " search with given relative error. Must be in the range [0,1).", "e", 0) | |
PARAM_DOUBLE_IN ("percentage", "If specified, will do approximate furthest " "neighbor search. Must be in the range (0,1] (decimal form). Resultant " "neighbors will be at least (p*100) % of the distance as the true furthest " "neighbor.", "p", 1) | |
Implementation of the KFN executable. Allows some number of standard options.
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.