[mlpack-git] master: Merge branch 'master' into bindings (7bed982)
gitdub at mlpack.org
gitdub at mlpack.org
Wed Jul 13 10:12:06 EDT 2016
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/59bc0b32630a3ad786706993f4d5e8b087f1c702...0d9a0e263a32b99d8dcf5d2723b3b92c67e669fc
>---------------------------------------------------------------
commit 7bed982fd80c35e3d7d187b35338f621ae0b2f4f
Merge: 6ff92c9 e434aee
Author: Ryan Curtin <ryan at ratml.org>
Date: Wed Jul 13 10:12:06 2016 -0400
Merge branch 'master' into bindings
>---------------------------------------------------------------
7bed982fd80c35e3d7d187b35338f621ae0b2f4f
.appveyor.yml | 22 +-
.gitignore | 5 -
CMake/CXX11.cmake | 2 +-
CMake/NewCXX11.cmake | 17 +
CMakeLists.txt | 45 +-
COPYRIGHT.txt | 5 +
HISTORY.md | 27 +-
LICENSE.txt | 12 +-
README.md | 8 +-
doc/guide/build.hpp | 20 +-
doc/tutorials/README.md | 48 +-
doc/tutorials/kmeans/kmeans.txt | 10 +-
src/mlpack/CMakeLists.txt | 5 +
src/mlpack/core.hpp | 12 +-
src/mlpack/core/arma_extend/CMakeLists.txt | 5 +-
src/mlpack/core/arma_extend/Mat_extra_bones.hpp | 10 +
src/mlpack/core/arma_extend/Mat_extra_meat.hpp | 10 +
src/mlpack/core/arma_extend/README.md | 23 +
src/mlpack/core/arma_extend/SpMat_extra_bones.hpp | 40 +-
src/mlpack/core/arma_extend/SpMat_extra_meat.hpp | 323 +-------
src/mlpack/core/arma_extend/arma_extend.hpp | 6 +-
src/mlpack/core/arma_extend/fn_ind2sub.hpp | 78 ++
src/mlpack/core/arma_extend/hdf5_misc.hpp | 11 +
src/mlpack/core/arma_extend/operator_minus.hpp | 10 +
src/mlpack/core/arma_extend/promote_type.hpp | 50 --
src/mlpack/core/arma_extend/restrictors.hpp | 22 -
src/mlpack/core/arma_extend/traits.hpp | 49 --
src/mlpack/core/arma_extend/typedef.hpp | 30 -
src/mlpack/core/boost_backport/LICENSE.txt | 23 +
src/mlpack/core/boost_backport/README.md | 11 +-
.../unordered_collections_load_imp.hpp | 3 +
.../unordered_collections_save_imp.hpp | 3 +
src/mlpack/core/boost_backport/unordered_map.hpp | 5 +-
src/mlpack/core/data/CMakeLists.txt | 1 +
src/mlpack/core/data/binarize.hpp | 99 +++
src/mlpack/core/dists/gaussian_distribution.hpp | 2 +-
src/mlpack/core/metrics/ip_metric.hpp | 2 +-
src/mlpack/core/metrics/ip_metric_impl.hpp | 10 +-
src/mlpack/core/metrics/lmetric.hpp | 3 +-
src/mlpack/core/metrics/lmetric_impl.hpp | 57 +-
src/mlpack/core/optimizers/lbfgs/lbfgs.hpp | 4 +-
src/mlpack/core/tree/CMakeLists.txt | 24 +
.../binary_space_tree/binary_space_tree_impl.hpp | 1 -
.../core/tree/cover_tree/cover_tree_impl.hpp | 1 -
src/mlpack/core/tree/hrectbound.hpp | 20 +
src/mlpack/core/tree/hrectbound_impl.hpp | 78 ++
src/mlpack/core/tree/rectangle_tree.hpp | 14 +
.../tree/rectangle_tree/discrete_hilbert_value.hpp | 263 +++++++
.../rectangle_tree/discrete_hilbert_value_impl.hpp | 457 ++++++++++++
.../tree/rectangle_tree/dual_tree_traverser.hpp | 7 +-
.../rectangle_tree/dual_tree_traverser_impl.hpp | 24 +-
.../hilbert_r_tree_auxiliary_information.hpp | 120 +++
.../hilbert_r_tree_auxiliary_information_impl.hpp | 169 +++++
.../hilbert_r_tree_descent_heuristic.hpp | 53 ++
.../hilbert_r_tree_descent_heuristic_impl.hpp | 49 ++
.../tree/rectangle_tree/hilbert_r_tree_split.hpp | 94 +++
.../rectangle_tree/hilbert_r_tree_split_impl.hpp | 342 +++++++++
.../tree/rectangle_tree/minimal_coverage_sweep.hpp | 97 +++
.../rectangle_tree/minimal_coverage_sweep_impl.hpp | 194 +++++
.../rectangle_tree/minimal_splits_number_sweep.hpp | 73 ++
.../minimal_splits_number_sweep_impl.hpp | 112 +++
.../rectangle_tree/no_auxiliary_information.hpp | 135 ++++
.../r_plus_plus_tree_auxiliary_information.hpp | 148 ++++
...r_plus_plus_tree_auxiliary_information_impl.hpp | 130 ++++
.../r_plus_plus_tree_descent_heuristic.hpp | 48 ++
.../r_plus_plus_tree_descent_heuristic_impl.hpp | 48 ++
.../r_plus_plus_tree_split_policy.hpp | 74 ++
.../r_plus_tree_descent_heuristic.hpp | 48 ++
.../r_plus_tree_descent_heuristic_impl.hpp | 103 +++
.../core/tree/rectangle_tree/r_plus_tree_split.hpp | 129 ++++
.../tree/rectangle_tree/r_plus_tree_split_impl.hpp | 360 +++++++++
.../rectangle_tree/r_plus_tree_split_policy.hpp | 74 ++
.../r_star_tree_descent_heuristic.hpp | 16 +-
.../r_star_tree_descent_heuristic_impl.hpp | 50 +-
.../core/tree/rectangle_tree/r_star_tree_split.hpp | 24 +-
.../tree/rectangle_tree/r_star_tree_split_impl.hpp | 171 ++---
.../rectangle_tree/r_tree_descent_heuristic.hpp | 4 +-
.../r_tree_descent_heuristic_impl.hpp | 32 +-
.../core/tree/rectangle_tree/r_tree_split.hpp | 29 +-
.../core/tree/rectangle_tree/r_tree_split_impl.hpp | 147 ++--
.../core/tree/rectangle_tree/rectangle_tree.hpp | 106 ++-
.../tree/rectangle_tree/rectangle_tree_impl.hpp | 466 +++++++-----
.../tree/rectangle_tree/single_tree_traverser.hpp | 7 +-
.../rectangle_tree/single_tree_traverser_impl.hpp | 20 +-
src/mlpack/core/tree/rectangle_tree/traits.hpp | 7 +-
src/mlpack/core/tree/rectangle_tree/typedef.hpp | 103 ++-
.../x_tree_auxiliary_information.hpp | 186 +++++
.../core/tree/rectangle_tree/x_tree_split.hpp | 62 +-
.../core/tree/rectangle_tree/x_tree_split_impl.hpp | 250 +++----
src/mlpack/core/util/CMakeLists.txt | 2 -
src/mlpack/core/util/backtrace.cpp | 7 -
src/mlpack/core/util/backtrace.hpp | 7 -
src/mlpack/core/util/cli.cpp | 55 +-
src/mlpack/core/util/cli.hpp | 18 +-
src/mlpack/core/util/cli_impl.hpp | 49 +-
src/mlpack/core/util/prefixedoutstream.hpp | 1 -
src/mlpack/core/util/string_util.cpp | 47 --
src/mlpack/core/util/string_util.hpp | 23 -
src/mlpack/methods/CMakeLists.txt | 1 +
src/mlpack/methods/amf/init_rules/CMakeLists.txt | 1 +
src/mlpack/methods/amf/init_rules/given_init.hpp | 75 ++
src/mlpack/methods/ann/CMakeLists.txt | 1 -
src/mlpack/methods/ann/ffn.hpp | 24 +-
src/mlpack/methods/ann/rnn.hpp | 20 +-
src/mlpack/methods/ann/trainer/trainer.hpp | 310 --------
src/mlpack/methods/det/det_main.cpp | 2 +-
src/mlpack/methods/emst/dtb_rules.hpp | 28 -
src/mlpack/methods/emst/dtb_rules_impl.hpp | 46 --
src/mlpack/methods/emst/emst_main.cpp | 18 +-
src/mlpack/methods/gmm/gmm_generate_main.cpp | 4 +
src/mlpack/methods/gmm/gmm_impl.hpp | 2 +-
src/mlpack/methods/gmm/gmm_probability_main.cpp | 12 +-
src/mlpack/methods/hmm/hmm_generate_main.cpp | 12 +-
src/mlpack/methods/hmm/hmm_train_main.cpp | 4 +-
src/mlpack/methods/hmm/hmm_viterbi_main.cpp | 11 +-
.../hoeffding_trees/hoeffding_tree_main.cpp | 37 +-
src/mlpack/methods/kmeans/CMakeLists.txt | 1 +
src/mlpack/methods/kmeans/allow_empty_clusters.hpp | 15 +-
.../methods/kmeans/dual_tree_kmeans_impl.hpp | 1 -
src/mlpack/methods/kmeans/elkan_kmeans_impl.hpp | 2 -
src/mlpack/methods/kmeans/hamerly_kmeans_impl.hpp | 2 -
..._empty_clusters.hpp => kill_empty_clusters.hpp} | 25 +-
src/mlpack/methods/kmeans/kmeans_main.cpp | 26 +-
src/mlpack/methods/kmeans/naive_kmeans.hpp | 5 +-
src/mlpack/methods/kmeans/naive_kmeans_impl.hpp | 2 -
.../methods/kmeans/pelleg_moore_kmeans_impl.hpp | 6 +-
src/mlpack/methods/lars/lars_main.cpp | 32 +-
.../linear_regression/linear_regression_main.cpp | 47 +-
src/mlpack/methods/lsh/lsh_main.cpp | 30 +-
src/mlpack/methods/lsh/lsh_search.hpp | 167 ++++-
src/mlpack/methods/lsh/lsh_search_impl.hpp | 808 +++++++++++++++++----
src/mlpack/methods/mvu/mvu_main.cpp | 14 +-
src/mlpack/methods/neighbor_search/CMakeLists.txt | 30 +-
src/mlpack/methods/neighbor_search/kfn_main.cpp | 43 +-
src/mlpack/methods/neighbor_search/knn_main.cpp | 28 +-
.../methods/neighbor_search/neighbor_search.hpp | 24 +-
.../neighbor_search/neighbor_search_impl.hpp | 36 +-
.../neighbor_search/neighbor_search_rules.hpp | 4 +
.../neighbor_search/neighbor_search_rules_impl.hpp | 14 +-
.../neighbor_search/neighbor_search_stat.hpp | 11 +
src/mlpack/methods/neighbor_search/ns_model.hpp | 264 ++++++-
.../methods/neighbor_search/ns_model_impl.hpp | 576 +++++++--------
.../sort_policies/furthest_neighbor_sort.cpp | 4 +-
.../sort_policies/furthest_neighbor_sort.hpp | 17 +
.../sort_policies/nearest_neighbor_sort.hpp | 15 +
src/mlpack/methods/pca/CMakeLists.txt | 4 +-
.../decomposition_policies}/CMakeLists.txt | 4 +-
.../decomposition_policies/exact_svd_method.hpp | 72 ++
.../pca/decomposition_policies/quic_svd_method.hpp | 92 +++
.../randomized_svd_method.hpp | 97 +++
src/mlpack/methods/pca/pca.hpp | 85 ++-
src/mlpack/methods/pca/{pca.cpp => pca_impl.hpp} | 118 +--
src/mlpack/methods/pca/pca_main.cpp | 75 +-
src/mlpack/methods/perceptron/perceptron_main.cpp | 15 +-
src/mlpack/methods/preprocess/CMakeLists.txt | 1 +
.../preprocess/preprocess_binarize_main.cpp | 85 +++
.../methods/preprocess/preprocess_split_main.cpp | 77 +-
src/mlpack/methods/quic_svd/CMakeLists.txt | 2 +-
.../quic_svd/{quic_svd_impl.hpp => quic_svd.cpp} | 7 +-
src/mlpack/methods/quic_svd/quic_svd.hpp | 7 +-
.../{quic_svd => randomized_svd}/CMakeLists.txt | 4 +-
.../methods/randomized_svd/randomized_svd.cpp | 128 ++++
.../methods/randomized_svd/randomized_svd.hpp | 133 ++++
.../methods/range_search/range_search_main.cpp | 15 +-
src/mlpack/methods/range_search/rs_model.cpp | 59 +-
src/mlpack/methods/range_search/rs_model.hpp | 11 +-
src/mlpack/methods/range_search/rs_model_impl.hpp | 42 ++
src/mlpack/methods/rann/CMakeLists.txt | 20 +-
.../rann/{allkrann_main.cpp => krann_main.cpp} | 18 +-
src/mlpack/methods/rann/ra_model.hpp | 11 +-
src/mlpack/methods/rann/ra_model_impl.hpp | 164 ++++-
src/mlpack/methods/rann/ra_typedef.hpp | 43 +-
.../softmax_regression/softmax_regression_main.cpp | 78 +-
src/mlpack/prereqs.hpp | 1 +
src/mlpack/tests/CMakeLists.txt | 9 +-
src/mlpack/tests/activation_functions_test.cpp | 2 +-
src/mlpack/tests/ada_delta_test.cpp | 2 +-
src/mlpack/tests/adaboost_test.cpp | 3 +-
src/mlpack/tests/adam_test.cpp | 2 +-
src/mlpack/tests/akfn_test.cpp | 240 ++++++
src/mlpack/tests/aknn_test.cpp | 409 +++++++++++
src/mlpack/tests/arma_extend_test.cpp | 2 +-
src/mlpack/tests/armadillo_svd_test.cpp | 2 +-
src/mlpack/tests/aug_lagrangian_test.cpp | 2 +-
src/mlpack/tests/binarize_test.cpp | 66 ++
src/mlpack/tests/cf_test.cpp | 2 +-
src/mlpack/tests/cli_test.cpp | 2 +-
src/mlpack/tests/convolution_test.cpp | 2 +-
src/mlpack/tests/convolutional_network_test.cpp | 2 +-
src/mlpack/tests/cosine_tree_test.cpp | 2 +-
src/mlpack/tests/decision_stump_test.cpp | 2 +-
src/mlpack/tests/det_test.cpp | 2 +-
src/mlpack/tests/distribution_test.cpp | 2 +-
src/mlpack/tests/emst_test.cpp | 2 +-
src/mlpack/tests/fastmks_test.cpp | 2 +-
src/mlpack/tests/feedforward_network_test.cpp | 2 +-
src/mlpack/tests/gmm_test.cpp | 40 +-
src/mlpack/tests/hmm_test.cpp | 2 +-
src/mlpack/tests/hoeffding_tree_test.cpp | 2 +-
src/mlpack/tests/ind2sub_test.cpp | 30 +
src/mlpack/tests/init_rules_test.cpp | 2 +-
src/mlpack/tests/kernel_pca_test.cpp | 2 +-
src/mlpack/tests/kernel_test.cpp | 2 +-
src/mlpack/tests/kernel_traits_test.cpp | 2 +-
src/mlpack/tests/kfn_test.cpp | 2 +-
src/mlpack/tests/kmeans_test.cpp | 3 +-
src/mlpack/tests/knn_test.cpp | 26 +-
...krann_search_test.cpp => krann_search_test.cpp} | 22 +-
src/mlpack/tests/lars_test.cpp | 2 +-
src/mlpack/tests/layer_traits_test.cpp | 2 +-
src/mlpack/tests/lbfgs_test.cpp | 2 +-
src/mlpack/tests/lin_alg_test.cpp | 2 +-
src/mlpack/tests/linear_regression_test.cpp | 2 +-
src/mlpack/tests/load_save_test.cpp | 2 +-
src/mlpack/tests/local_coordinate_coding_test.cpp | 2 +-
src/mlpack/tests/log_test.cpp | 2 +-
src/mlpack/tests/logistic_regression_test.cpp | 2 +-
src/mlpack/tests/lrsdp_test.cpp | 2 +-
src/mlpack/tests/lsh_test.cpp | 510 ++++++++++++-
src/mlpack/tests/lstm_peephole_test.cpp | 2 +-
src/mlpack/tests/math_test.cpp | 2 +-
src/mlpack/tests/matrix_completion_test.cpp | 2 +-
src/mlpack/tests/maximal_inputs_test.cpp | 2 +-
src/mlpack/tests/mean_shift_test.cpp | 3 +-
src/mlpack/tests/metric_test.cpp | 6 +-
src/mlpack/tests/minibatch_sgd_test.cpp | 2 +-
src/mlpack/tests/mlpack_test.cpp | 2 +-
src/mlpack/tests/nbc_test.cpp | 2 +-
src/mlpack/tests/nca_test.cpp | 2 +-
src/mlpack/tests/network_util_test.cpp | 2 +-
src/mlpack/tests/nmf_test.cpp | 17 +-
src/mlpack/tests/nystroem_method_test.cpp | 2 +-
src/mlpack/tests/pca_test.cpp | 109 ++-
src/mlpack/tests/perceptron_test.cpp | 2 +-
src/mlpack/tests/performance_functions_test.cpp | 2 +-
src/mlpack/tests/pooling_rules_test.cpp | 2 +-
src/mlpack/tests/quic_svd_test.cpp | 36 +-
src/mlpack/tests/radical_test.cpp | 2 +-
src/mlpack/tests/randomized_svd_test.cpp | 62 ++
src/mlpack/tests/range_search_test.cpp | 24 +-
src/mlpack/tests/rectangle_tree_test.cpp | 698 +++++++++++++++---
src/mlpack/tests/recurrent_network_test.cpp | 109 +--
src/mlpack/tests/regularized_svd_test.cpp | 2 +-
src/mlpack/tests/rmsprop_test.cpp | 2 +-
src/mlpack/tests/sa_test.cpp | 2 +-
src/mlpack/tests/sdp_primal_dual_test.cpp | 2 +-
src/mlpack/tests/serialization.hpp | 2 +-
src/mlpack/tests/serialization_test.cpp | 14 +-
src/mlpack/tests/sgd_test.cpp | 2 +-
src/mlpack/tests/softmax_regression_test.cpp | 2 +-
src/mlpack/tests/sort_policy_test.cpp | 2 +-
src/mlpack/tests/sparse_autoencoder_test.cpp | 2 +-
src/mlpack/tests/sparse_coding_test.cpp | 2 +-
src/mlpack/tests/split_data_test.cpp | 2 +-
src/mlpack/tests/svd_batch_test.cpp | 2 +-
src/mlpack/tests/svd_incremental_test.cpp | 2 +-
src/mlpack/tests/termination_policy_test.cpp | 2 +-
...d_boost_test_definitions.hpp => test_tools.hpp} | 14 +-
src/mlpack/tests/tree_test.cpp | 30 +-
src/mlpack/tests/tree_traits_test.cpp | 2 +-
src/mlpack/tests/union_find_test.cpp | 2 +-
261 files changed, 10285 insertions(+), 3154 deletions(-)
diff --cc src/mlpack/core/util/cli.cpp
index 1f6dd29,21b41fe..708f851
--- a/src/mlpack/core/util/cli.cpp
+++ b/src/mlpack/core/util/cli.cpp
@@@ -99,14 -95,11 +95,14 @@@ CLI::~CLI(
* @param description Short string description of the parameter.
* @param alias An alias for the parameter.
* @param required Indicates if parameter must be set on command line.
+ * @param input If true, the parameter is an input parameter (not an output
+ * parameter).
*/
- void CLI::Add(const std::string& path,
+ void CLI::Add(const std::string& identifier,
const std::string& description,
const std::string& alias,
- bool required)
+ const bool required,
+ const bool input)
{
po::options_description& desc = CLI::GetSingleton().desc;
@@@ -133,15 -127,8 +130,15 @@@
// If the option is required, add it to the required options list.
if (required)
- GetSingleton().requiredOptions.push_front(path);
+ GetSingleton().requiredOptions.push_front(identifier);
+ // Depending on whether the option is input or output, add it to the list of
+ // input or output options.
+ if (input)
- GetSingleton().inputOptions.push_front(path);
++ GetSingleton().inputOptions.push_front(identifier);
+ else
- GetSingleton().outputOptions.push_front(path);
++ GetSingleton().outputOptions.push_front(identifier);
+
return;
}
diff --cc src/mlpack/core/util/cli.hpp
index 56c1202,8f9cf3f..dd98c0f
--- a/src/mlpack/core/util/cli.hpp
+++ b/src/mlpack/core/util/cli.hpp
@@@ -348,14 -666,9 +341,14 @@@ class CL
//! Values of the options given by user.
po::variables_map vmap;
- //! Pathnames of required options.
+ //! Identifier names of required options.
std::list<std::string> requiredOptions;
+ //! Pathnames of input options.
+ std::list<std::string> inputOptions;
+ //! Pathnames of output options.
+ std::list<std::string> outputOptions;
+
//! Map of global values.
typedef std::map<std::string, ParamData> gmap_t;
gmap_t globalValues;
diff --cc src/mlpack/core/util/cli_impl.hpp
index 4592650,cc7c896..bc5b366
--- a/src/mlpack/core/util/cli_impl.hpp
+++ b/src/mlpack/core/util/cli_impl.hpp
@@@ -22,20 -23,44 +23,47 @@@ namespace mlpack
* @tparam T The type of the parameter.
* @param identifier The name of the parameter, eg foo in bar/foo.
* @param description A string description of the parameter.
- * @param parent The name of the parent of the parameter,
- * eg bar/foo in bar/foo/buzz.
- * @param required If required, the program will refuse to run
- * unless the parameter is specified.
+ * @param parent The name of the parent of the parameter, e.g. bar/foo in
+ * bar/foo/buzz.
+ * @param required If required, the program will refuse to run unless the
+ * parameter is specified.
+ * @param input If true, the parameter is an input parameter (not an output
+ * parameter).
*/
template<typename T>
- void CLI::Add(const std::string& path,
+ void CLI::Add(const std::string& identifier,
const std::string& description,
const std::string& alias,
- bool required)
+ const bool required,
+ const bool input)
{
+ // Temporarily define color code escape sequences.
+ #ifndef _WIN32
+ #define BASH_RED "\033[0;31m"
+ #define BASH_CLEAR "\033[0m"
+ #else
+ #define BASH_RED ""
+ #define BASH_CLEAR ""
+ #endif
+
+ // Temporary outstream object for detecting duplicate identifiers.
+ util::PrefixedOutStream outstr(std::cerr,
+ BASH_RED "[FATAL] " BASH_CLEAR, false, true /* fatal */);
+
+ #undef BASH_RED
+ #undef BASH_CLEAR
+
+ // Define identifier and alias maps.
+ gmap_t& gmap = GetSingleton().globalValues;
+ amap_t& amap = GetSingleton().aliasValues;
+
+ // If found in current map, print fatal error and terminate the program.
+ if (gmap.count(identifier))
+ outstr << "Parameter --" << identifier << "(-" << alias << ") "
+ << "is defined multiple times with same identifiers." << std::endl;
+ if (amap.count(alias))
+ outstr << "Parameter --" << identifier << "(-" << alias << ") "
+ << "is defined multiple times with same alias." << std::endl;
po::options_description& desc = CLI::GetSingleton().desc;
// Must make use of boost syntax here.
@@@ -63,14 -87,7 +90,14 @@@
// If the option is required, add it to the required options list.
if (required)
- GetSingleton().requiredOptions.push_front(path);
+ GetSingleton().requiredOptions.push_front(identifier);
+
+ // Depending on whether or not the option is input or output, add it to the
+ // appropriate list.
+ if (input)
- GetSingleton().inputOptions.push_front(path);
++ GetSingleton().inputOptions.push_front(identifier);
+ else
- GetSingleton().outputOptions.push_front(path);
++ GetSingleton().outputOptions.push_front(identifier);
}
// We specialize this in cli.cpp.
diff --cc src/mlpack/methods/emst/emst_main.cpp
index f9b5a69,f6d18be..ffc2d6a
--- a/src/mlpack/methods/emst/emst_main.cpp
+++ b/src/mlpack/methods/emst/emst_main.cpp
@@@ -50,14 -52,15 +50,15 @@@ int main(int argc, char* argv[]
{
CLI::ParseCommandLine(argc, argv);
+ const string inputFile = CLI::GetParam<string>("input_file");
- const string outputFile= CLI::GetParam<string>("output_file");
++ const string outputFile = CLI::GetParam<string>("output_file");
+
- if (CLI::HasParam("output_file"))
- Log::Warn << "--output_file (-o) is not specified; no results will be "
- << "saved!" << endl;
+ if (!CLI::HasParam("output_file"))
+ Log::Warn << "--output_file is not specified, so no output will be saved!"
+ << endl;
- const string dataFilename = CLI::GetParam<string>("input_file");
-
arma::mat dataPoints;
- data::Load(dataFilename, dataPoints, true);
+ data::Load(inputFile, dataPoints, true);
// Do naive computation if necessary.
if (CLI::GetParam<bool>("naive"))
diff --cc src/mlpack/methods/hmm/hmm_generate_main.cpp
index 352c98d,53d45dc..739859c
--- a/src/mlpack/methods/hmm/hmm_generate_main.cpp
+++ b/src/mlpack/methods/hmm/hmm_generate_main.cpp
@@@ -64,13 -66,8 +65,12 @@@ struct Generat
data::Save(outputFile, observations, true);
// Do we want to save the hidden sequence?
- const string sequenceFile = CLI::GetParam<string>("state_file");
- if (sequenceFile != "")
+ if (CLI::HasParam("state_file"))
data::Save(sequenceFile, sequence, true);
+
+ if (outputFile == "" && sequenceFile == "")
+ Log::Warn << "Neither --output_file nor --state_file are specified; no "
+ << "output will be saved." << endl;
}
};
diff --cc src/mlpack/methods/kmeans/kmeans_main.cpp
index 24226cb,a197f77..ededb91
--- a/src/mlpack/methods/kmeans/kmeans_main.cpp
+++ b/src/mlpack/methods/kmeans/kmeans_main.cpp
@@@ -56,19 -67,21 +68,21 @@@ PARAM_INT_IN_REQ("clusters", "Number o
PARAM_FLAG("in_place", "If specified, a column containing the learned cluster "
"assignments will be added to the input dataset file. In this case, "
"--outputFile is overridden.", "P");
-PARAM_STRING("output_file", "File to write output labels or labeled data to.",
- "o", "");
-PARAM_STRING("centroid_file", "If specified, the centroids of each cluster will"
- " be written to the given file.", "C", "");
+PARAM_STRING_OUT("output_file", "File to write output labels or labeled data "
+ "to.", "o");
+PARAM_STRING_OUT("centroid_file", "If specified, the centroids of each cluster "
+ "will be written to the given file.", "C");
// k-means configuration options.
- PARAM_FLAG("allow_empty_clusters", "Allow empty clusters to be created.", "e");
+ PARAM_FLAG("allow_empty_clusters", "Allow empty clusters to be persist.", "e");
+ PARAM_FLAG("kill_empty_clusters", "Remove empty clusters when they occur.",
+ "E");
PARAM_FLAG("labels_only", "Only output labels into output file.", "l");
-PARAM_INT("max_iterations", "Maximum number of iterations before K-Means "
+PARAM_INT_IN("max_iterations", "Maximum number of iterations before k-means "
"terminates.", "m", 1000);
-PARAM_INT("seed", "Random seed. If 0, 'std::time(NULL)' is used.", "s", 0);
-PARAM_STRING("initial_centroids", "Start with the specified initial centroids.",
- "I", "");
+PARAM_INT_IN("seed", "Random seed. If 0, 'std::time(NULL)' is used.", "s", 0);
+PARAM_STRING_IN("initial_centroids", "Start with the specified initial "
+ "centroids.", "I", "");
// Parameters for "refined start" k-means.
PARAM_FLAG("refined_start", "Use the refined initial point strategy by Bradley "
diff --cc src/mlpack/methods/linear_regression/linear_regression_main.cpp
index 7fd51ee,047cc7c..f8336f2
--- a/src/mlpack/methods/linear_regression/linear_regression_main.cpp
+++ b/src/mlpack/methods/linear_regression/linear_regression_main.cpp
@@@ -22,25 -22,26 +22,26 @@@ PROGRAM_INFO("Simple Linear Regression
" another matrix X' (--test_file):\n\n"
" y' = X' * b\n\n"
"and these predicted responses, y', are saved to a file "
- "(--output_predictions). This type of regression is related to least-angle"
- " regression, which mlpack implements with the 'lars' executable.");
+ "(--output_predictions). This type of regression is related to "
+ "least-angle regression, which mlpack implements with the 'lars' "
+ "executable.");
-PARAM_STRING("training_file", "File containing training set X (regressors).",
+PARAM_STRING_IN("training_file", "File containing training set X (regressors).",
"t", "");
-PARAM_STRING("training_responses", "Optional file containing y "
- "(responses). If not given, the responses are assumed to be the last row "
- "of the input file.", "r", "");
+PARAM_STRING_IN("training_responses", "Optional file containing y (responses). "
+ "If not given, the responses are assumed to be the last row of the input "
+ "file.", "r", "");
-PARAM_STRING("input_model_file", "File containing existing model (parameters).",
- "m", "");
-PARAM_STRING("output_model_file", "File to save trained model to.", "M", "");
+PARAM_STRING_IN("input_model_file", "File containing existing model "
+ "(parameters).", "m", "");
+PARAM_STRING_OUT("output_model_file", "File to save trained model to.", "M");
-PARAM_STRING("test_file", "File containing X' (test regressors).", "T", "");
-PARAM_STRING("output_predictions", "If --test_file is specified, this "
- "file is where the predicted responses will be saved.", "p", "");
+PARAM_STRING_IN("test_file", "File containing X' (test regressors).", "T", "");
+PARAM_STRING_OUT("output_predictions", "If --test_file is specified, this file "
+ "is where the predicted responses will be saved.", "p");
-PARAM_DOUBLE("lambda", "Tikhonov regularization for ridge regression. If 0, "
- "the method reduces to linear regression.", "l", 0.0);
+PARAM_DOUBLE_IN("lambda", "Tikhonov regularization for ridge regression. If 0,"
+ " the method reduces to linear regression.", "l", 0.0);
using namespace mlpack;
using namespace mlpack::regression;
@@@ -102,12 -109,6 +109,12 @@@ int main(int argc, char* argv[]
Log::Warn << "--lambda ignored because no model is being trained." << endl;
}
- if (outputModelFile == "" && outputPredictions == "")
++ if (outputModelFile == "" && outputPredictionsFile == "")
+ {
+ Log::Warn << "Neither --output_model_file nor --output_predictions are "
+ << "specified; no output will be saved!" << endl;
+ }
+
// An input file was given and we need to generate the model.
if (computeModel)
{
diff --cc src/mlpack/methods/neighbor_search/kfn_main.cpp
index 3e08fbb,6adbc56..ccb30d3
--- a/src/mlpack/methods/neighbor_search/kfn_main.cpp
+++ b/src/mlpack/methods/neighbor_search/kfn_main.cpp
@@@ -61,17 -61,25 +61,25 @@@ PARAM_INT_IN("k", "Number of furthest n
// The user may specify the type of tree to use, and a few pararmeters for tree
// building.
-PARAM_STRING("tree_type", "Type of tree to use: 'kd', 'cover', 'r', 'r-star', "
- "'x', 'ball', 'hilbert-r', 'r-plus', 'r-plus-plus'.", "t", "kd");
-PARAM_INT("leaf_size", "Leaf size for tree building (used for kd-trees, R "
+PARAM_STRING_IN("tree_type", "Type of tree to use: 'kd', 'cover', 'r', "
- "'r-star', 'x', 'ball'.", "t", "kd");
- PARAM_INT_IN("leaf_size", "Leaf size for tree building.", "l", 20);
++ "'r-star', 'x', 'ball', 'hilbert-r', 'r-plus', 'r-plus-plus'.", "t", "kd");
++PARAM_INT_IN("leaf_size", "Leaf size for tree building (used for kd-trees, R "
+ "trees, R* trees, X trees, Hilbert R trees, R+ trees and R++ trees).", "l",
+ 20);
PARAM_FLAG("random_basis", "Before tree-building, project the data onto a "
"random orthogonal basis.", "R");
-PARAM_INT("seed", "Random seed (if 0, std::time(NULL) is used).", "s", 0);
+PARAM_INT_IN("seed", "Random seed (if 0, std::time(NULL) is used).", "s", 0);
// Search settings.
PARAM_FLAG("naive", "If true, O(n^2) naive mode is used for computation.", "N");
PARAM_FLAG("single_mode", "If true, single-tree search is used (as opposed to "
"dual-tree search).", "s");
-PARAM_DOUBLE("epsilon", "If specified, will do approximate furthest neighbor "
- "search with given relative error. Must be in the range [0,1).", "e", 0);
-PARAM_DOUBLE("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);
++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);
// Convenience typedef.
typedef NSModel<FurthestNeighborSort> KFNModel;
diff --cc src/mlpack/methods/neighbor_search/knn_main.cpp
index 3cd37ac,87bdb32..14e07db
--- a/src/mlpack/methods/neighbor_search/knn_main.cpp
+++ b/src/mlpack/methods/neighbor_search/knn_main.cpp
@@@ -63,18 -62,21 +63,21 @@@ PARAM_INT_IN("k", "Number of nearest ne
// The user may specify the type of tree to use, and a few parameters for tree
// building.
-PARAM_STRING("tree_type", "Type of tree to use: 'kd', 'cover', 'r', 'r-star', "
- "'x', 'ball', 'hilbert-r', 'r-plus', 'r-plus-plus'.", "t", "kd");
-PARAM_INT("leaf_size", "Leaf size for tree building (used for kd-trees, R "
+PARAM_STRING_IN("tree_type", "Type of tree to use: 'kd', 'cover', 'r', "
- "'r-star', 'x', 'ball'.", "t", "kd");
++ "'r-star', 'x', 'ball', 'hilbert-r', 'r-plus', 'r-plus-plus'.", "t", "kd");
+PARAM_INT_IN("leaf_size", "Leaf size for tree building (used for kd-trees, R "
- "trees, and R* trees).", "l", 20);
+ "trees, R* trees, X trees, Hilbert R trees, R+ trees and R++ trees).", "l",
+ 20);
PARAM_FLAG("random_basis", "Before tree-building, project the data onto a "
"random orthogonal basis.", "R");
-PARAM_INT("seed", "Random seed (if 0, std::time(NULL) is used).", "s", 0);
+PARAM_INT_IN("seed", "Random seed (if 0, std::time(NULL) is used).", "s", 0);
// Search settings.
PARAM_FLAG("naive", "If true, O(n^2) naive mode is used for computation.", "N");
PARAM_FLAG("single_mode", "If true, single-tree search is used (as opposed to "
"dual-tree search).", "S");
-PARAM_DOUBLE("epsilon", "If specified, will do approximate nearest neighbor "
++PARAM_DOUBLE_IN("epsilon", "If specified, will do approximate nearest neighbor "
+ "search with given relative error.", "e", 0);
// Convenience typedef.
typedef NSModel<NearestNeighborSort> KNNModel;
diff --cc src/mlpack/methods/pca/pca_main.cpp
index 5bfaacd,9079391..f2f558c
--- a/src/mlpack/methods/pca/pca_main.cpp
+++ b/src/mlpack/methods/pca/pca_main.cpp
@@@ -14,22 -18,57 +18,56 @@@ using namespace std
// Document program.
PROGRAM_INFO("Principal Components Analysis", "This program performs principal "
- "components analysis on the given dataset. It will transform the data "
- "onto its principal components, optionally performing dimensionality "
- "reduction by ignoring the principal components with the smallest "
- "eigenvalues.");
+ "components analysis on the given dataset using the exact, randomized or "
+ "QUIC SVD method. It will transform the data onto its principal components,"
+ " optionally performing dimensionality reduction by ignoring the principal "
+ "components with the smallest eigenvalues.");
// Parameters for program.
-PARAM_STRING_REQ("input_file", "Input dataset to perform PCA on.", "i");
-PARAM_STRING_REQ("output_file", "File to save modified dataset to.", "o");
-
-PARAM_INT("new_dimensionality", "Desired dimensionality of output dataset. If "
- "0, no dimensionality reduction is performed.", "d", 0);
-PARAM_DOUBLE("var_to_retain", "Amount of variance to retain; should be between "
- "0 and 1. If 1, all variance is retained. Overrides -d.", "r", 0);
+PARAM_STRING_IN_REQ("input_file", "Input dataset to perform PCA on.", "i");
+PARAM_STRING_OUT("output_file", "File to save modified dataset to.", "o");
+PARAM_INT_IN("new_dimensionality", "Desired dimensionality of output dataset. "
+ "If 0, no dimensionality reduction is performed.", "d", 0);
+PARAM_DOUBLE_IN("var_to_retain", "Amount of variance to retain; should be "
+ "between 0 and 1. If 1, all variance is retained. Overrides -d.", "V", 0);
PARAM_FLAG("scale", "If set, the data will be scaled before running PCA, such "
"that the variance of each feature is 1.", "s");
-PARAM_STRING("decomposition_method", "Method used for the principal"
++PARAM_STRING_IN("decomposition_method", "Method used for the principal"
+ "components analysis: 'exact', 'randomized', 'quic'.", "c", "exact");
+
+
+ //! Run RunPCA on the specified dataset with the given decomposition method.
+ template<typename DecompositionPolicy>
+ void RunPCA(arma::mat& dataset,
+ const size_t newDimension,
+ const size_t scale,
+ const double varToRetain)
+ {
+ PCAType<DecompositionPolicy> p(scale);
+
+ Log::Info << "Performing PCA on dataset..." << endl;
+ double varRetained;
+
+ if (varToRetain != 0)
+ {
+ if (newDimension != 0)
+ Log::Warn << "New dimensionality (-d) ignored because -V was specified."
+ << endl;
+
+ varRetained = p.Apply(dataset, varToRetain);
+ }
+ else
+ {
+ varRetained = p.Apply(dataset, newDimension);
+ }
+
+ Log::Info << (varRetained * 100) << "% of variance retained (" <<
+ dataset.n_rows << " dimensions)." << endl;
+
+ }
+
int main(int argc, char** argv)
{
// Parse commandline.
@@@ -76,14 -114,12 +118,13 @@@
}
else
{
- varRetained = p.Apply(dataset, newDimension);
+ // Invalid decomposition method.
+ Log::Fatal << "Invalid decomposition method ('" << decompositionMethod
+ << "'); valid choices are 'exact', 'randomized', 'quic'." << endl;
}
- Log::Info << (varRetained * 100) << "% of variance retained (" <<
- dataset.n_rows << " dimensions)." << endl;
-
// Now save the results.
string outputFile = CLI::GetParam<string>("output_file");
- data::Save(outputFile, dataset);
+ if (outputFile != "")
+ data::Save(outputFile, dataset);
}
diff --cc src/mlpack/methods/perceptron/perceptron_main.cpp
index 875538b,3c99fc6..8b29842
--- a/src/mlpack/methods/perceptron/perceptron_main.cpp
+++ b/src/mlpack/methods/perceptron/perceptron_main.cpp
@@@ -124,10 -123,9 +124,13 @@@ int main(int argc, char** argv
Log::Warn << "Output will not be saved! (Neither --test_file nor "
<< "--output_model_file are specified.)" << endl;
+ if (testDataFile == "" && outputFile != "")
+ Log::Warn << "--output_file will be ignored because --test_file is not "
+ << "specified." << endl;
+
+ if (CLI::HasParam("test_file") && !CLI::HasParam("output_file"))
- Log::Fatal << "--output_file must be specified with --test_file" << endl;
++ Log::Fatal << "--output_file must be specified with --test_file." << endl;
+
// Now, load our model, if there is one.
Perceptron<>* p = NULL;
Col<size_t> mappings;
diff --cc src/mlpack/methods/preprocess/preprocess_binarize_main.cpp
index 0000000,433802a..ed050f1
mode 000000,100644..100644
--- a/src/mlpack/methods/preprocess/preprocess_binarize_main.cpp
+++ b/src/mlpack/methods/preprocess/preprocess_binarize_main.cpp
@@@ -1,0 -1,85 +1,85 @@@
+ /**
+ * @file preprocess_binarize_main.cpp
+ * @author Keon Kim
+ *
+ * binarize CLI executable
+ */
+ #include <mlpack/core.hpp>
+ #include <mlpack/core/data/binarize.hpp>
+
+ PROGRAM_INFO("Binarize Data", "This utility takes a dataset and binarizes the "
+ "variables into either 0 or 1 given threshold. User can apply binarization "
+ "on a dimension or the whole dataset. A dimension can be specified using "
+ "--dimension (-d) option. Threshold can also be specified with the "
+ "--threshold (-t) option; The default is 0.0."
+ "\n\n"
+ "The program does not modify the original file, but instead makes a "
+ "separate file to save the binarized data; The program requires you to "
+ "specify the file name with --output_file (-o)."
+ "\n\n"
+ "For example, if we want to make all variables greater than 5 in dataset "
+ "to 1 and ones that are less than or equal to 5.0 to 0, and save the "
+ "result to result.csv, we could run"
+ "\n\n"
+ "$ mlpack_preprocess_binarize -i dataset.csv -t 5 -o result.csv"
+ "\n\n"
+ "But if we want to apply this to only the first (0th) dimension of the "
+ "dataset, we could run"
+ "\n\n"
+ "$ mlpack_preprocess_binarize -i dataset.csv -t 5 -d 0 -o result.csv");
+
+ // Define parameters for data.
-PARAM_STRING_REQ("input_file", "File containing data,", "i");
++PARAM_STRING_IN_REQ("input_file", "File containing data,", "i");
+ // Define optional parameters.
-PARAM_STRING("output_file", "File to save the output,", "o", "");
-PARAM_INT("dimension", "Dimension to apply the binarization. If not set, the "
- "program will binarize every dimension by default", "d", 0);
-PARAM_DOUBLE("threshold", "Threshold to be applied for binarization. If not "
++PARAM_STRING_OUT("output_file", "File to save the output,", "o");
++PARAM_INT_IN("dimension", "Dimension to apply the binarization. If not set, the"
++ " program will binarize every dimension by default", "d", 0);
++PARAM_DOUBLE_IN("threshold", "Threshold to be applied for binarization. If not "
+ "set, the threshold defaults to 0.0", "t", 0.0);
+
+ using namespace mlpack;
+ using namespace arma;
+ using namespace std;
+
+ int main(int argc, char** argv)
+ {
+ // Parse command line options.
+ CLI::ParseCommandLine(argc, argv);
+ const string inputFile = CLI::GetParam<string>("input_file");
+ const string outputFile = CLI::GetParam<string>("output_file");
+ const size_t dimension = (size_t) CLI::GetParam<int>("dimension");
+ const double threshold = CLI::GetParam<double>("threshold");
+
+ // Check on data parameters.
+ if (!CLI::HasParam("dimension"))
+ Log::Warn << "You did not specify --dimension, so the program will perform "
+ << "binarize on every dimensions." << endl;
+
+ if (!CLI::HasParam("threshold"))
+ Log::Warn << "You did not specify --threshold, so the threshold "
+ << "will be automatically set to '0.0'." << endl;
+
+ if (!CLI::HasParam("output_file"))
+ Log::Warn << "You did not specify --output_file, so no result will be"
+ << "saved." << endl;
+
+ // Load the data.
+ arma::mat input;
+ arma::mat output;
+ data::Load(inputFile, input, true);
+
+ Timer::Start("binarize");
+ if (CLI::HasParam("dimension"))
+ {
+ data::Binarize<double>(input, output, threshold, dimension);
+ }
+ else
+ {
+ // binarize the whole data
+ data::Binarize<double>(input, output, threshold);
+ }
+ Timer::Stop("binarize");
+
+ if (CLI::HasParam("output_file"))
+ data::Save(outputFile, output, false);
+ }
diff --cc src/mlpack/methods/preprocess/preprocess_split_main.cpp
index fc41685,ca96411..9ecfb70
--- a/src/mlpack/methods/preprocess/preprocess_split_main.cpp
+++ b/src/mlpack/methods/preprocess/preprocess_split_main.cpp
@@@ -45,19 -39,16 +39,17 @@@ PROGRAM_INFO("Split Data", "This utilit
"> -L test_labels.csv");
// Define parameters for data.
-PARAM_STRING_REQ("input_file", "File containing data,", "i");
-PARAM_STRING_REQ("training_file", "File name to save train data", "t");
-PARAM_STRING_REQ("test_file", "File name to save test data", "T");
+PARAM_STRING_IN_REQ("input_file", "File containing data,", "i");
++PARAM_STRING_OUT("training_file", "File name to save train data", "t");
++PARAM_STRING_OUT("test_file", "File name to save test data", "T");
+
// Define optional parameters.
-PARAM_STRING("input_labels_file", "File containing labels", "I", "");
-PARAM_STRING("training_labels_file", "File name to save train label", "l", "");
-PARAM_STRING("test_labels_file", "File name to save test label", "L","");
+PARAM_STRING_IN("input_labels_file", "File containing labels", "I", "");
- PARAM_STRING_OUT("training_file", "File name to save train data", "t");
- PARAM_STRING_OUT("test_file", "File name to save test data", "T");
- PARAM_STRING_OUT("training_labels_file", "File name to save training labels "
- "to.", "l");
- PARAM_STRING_OUT("test_labels_file", "File name to save test labels to.",
- "L");
++PARAM_STRING_OUT("training_labels_file", "File name to save train label", "l");
++PARAM_STRING_OUT("test_labels_file", "File name to save test label", "L");
-// Define optional test ratio, default is 0.2 (Test 20% Train 80%)
-PARAM_DOUBLE("test_ratio", "Ratio of test set, if not set,"
+// Define optional test ratio, default is 0.2 (Test 20% Train 80%).
+PARAM_DOUBLE_IN("test_ratio", "Ratio of test set; if not set,"
"the ratio defaults to 0.2", "r", 0.2);
using namespace mlpack;
@@@ -70,29 -61,14 +62,20 @@@ int main(int argc, char** argv
CLI::ParseCommandLine(argc, argv);
const string inputFile = CLI::GetParam<string>("input_file");
const string inputLabels = CLI::GetParam<string>("input_labels_file");
- string trainingFile = CLI::GetParam<string>("training_file");
- string testFile = CLI::GetParam<string>("test_file");
- string trainingLabelsFile = CLI::GetParam<string>("training_labels_file");
- string testLabelsFile = CLI::GetParam<string>("test_labels_file");
+ const string trainingFile = CLI::GetParam<string>("training_file");
+ const string testFile = CLI::GetParam<string>("test_file");
+ const string trainingLabelsFile = CLI::GetParam<string>("training_labels_file");
+ const string testLabelsFile = CLI::GetParam<string>("test_labels_file");
const double testRatio = CLI::GetParam<double>("test_ratio");
- // Check on data parameters.
- if (trainingFile.empty())
- {
- trainingFile = "train_" + inputFile;
- Log::Warn << "You did not specify --training_file, so the training set file"
- << " name will be automatically set to '" << trainingFile << "'."
- << endl;
- }
- if (testFile.empty())
- {
- testFile = "test_" + inputFile;
- Log::Warn << "You did not specify --test_file, so the test set file name "
- << "will be automatically set to '" << testFile << "'." << endl;
- }
++ // Make sure the user specified output filenames.
++ if (trainingFile == "")
++ Log::Fatal << "--training_file (-t) must be specified!" << endl;
++ if (testFile == "")
++ Log::Fatal << "--test_file (-T) must be specified!" << endl;
+
// Check on label parameters.
- if (!inputLabels.empty())
+ if (CLI::HasParam("input_labels_file"))
{
if (!CLI::HasParam("training_labels_file"))
{
diff --cc src/mlpack/methods/range_search/range_search_main.cpp
index c8d0fea,c8ea2a5..3b8b088
--- a/src/mlpack/methods/range_search/range_search_main.cpp
+++ b/src/mlpack/methods/range_search/range_search_main.cpp
@@@ -70,12 -69,14 +70,14 @@@ PARAM_DOUBLE_IN("min", "Lower bound in
// The user may specify the type of tree to use, and a few parameters for tree
// building.
-PARAM_STRING("tree_type", "Type of tree to use: 'kd', 'cover', 'r', 'r-star', "
- "'x', 'ball', 'hilbert-r', 'r-plus', 'r-plus-plus'.", "t", "kd");
-PARAM_INT("leaf_size", "Leaf size for tree building (used for kd-trees, R "
+PARAM_STRING_IN("tree_type", "Type of tree to use: 'kd', 'cover', 'r', "
- "'r-star', 'x', 'ball'.", "t", "kd");
- PARAM_INT_IN("leaf_size", "Leaf size for tree building.", "l", 20);
++ "'r-star', 'x', 'ball', 'hilbert-r', 'r-plus', 'r-plus-plus'.", "t", "kd");
++PARAM_INT_IN("leaf_size", "Leaf size for tree building (used for kd-trees, R "
+ "trees, R* trees, X trees, Hilbert R trees, R+ trees and R++ trees).", "l",
+ 20);
PARAM_FLAG("random_basis", "Before tree-building, project the data onto a "
"random orthogonal basis.", "R");
-PARAM_INT("seed", "Random seed (if 0, std::time(NULL) is used).", "s", 0);
+PARAM_INT_IN("seed", "Random seed (if 0, std::time(NULL) is used).", "s", 0);
// Search settings.
PARAM_FLAG("naive", "If true, O(n^2) naive mode is used for computation.", "N");
diff --cc src/mlpack/methods/rann/krann_main.cpp
index c434fc7,f9a6c67..b8289dd
--- a/src/mlpack/methods/rann/krann_main.cpp
+++ b/src/mlpack/methods/rann/krann_main.cpp
@@@ -64,18 -63,19 +64,19 @@@ PARAM_INT_IN("k", "Number of nearest ne
// The user may specify the type of tree to use, and a few parameters for tree
// building.
-PARAM_STRING("tree_type", "Type of tree to use: 'kd', 'cover', 'r', or "
+PARAM_STRING_IN("tree_type", "Type of tree to use: 'kd', 'cover', 'r', or "
- "'x', 'r-star'.", "t", "kd");
+ "'x', 'r-star', 'hilbert-r', 'r-plus', 'r-plus-plus'.", "t", "kd");
-PARAM_INT("leaf_size", "Leaf size for tree building (used for kd-trees, R "
+PARAM_INT_IN("leaf_size", "Leaf size for tree building (used for kd-trees, R "
- "trees, and R* trees).", "l", 20);
+ "trees, R* trees, X trees, Hilbert R trees, R+ trees and R++ trees).", "l",
+ 20);
PARAM_FLAG("random_basis", "Before tree-building, project the data onto a "
"random orthogonal basis.", "R");
-PARAM_INT("seed", "Random seed (if 0, std::time(NULL) is used).", "s", 0);
+PARAM_INT_IN("seed", "Random seed (if 0, std::time(NULL) is used).", "s", 0);
// Search options.
-PARAM_DOUBLE("tau", "The allowed rank-error in terms of the percentile of "
- "the data.", "T", 5);
-PARAM_DOUBLE("alpha", "The desired success probability.", "a", 0.95);
+PARAM_DOUBLE_IN("tau", "The allowed rank-error in terms of the percentile of "
+ "the data.", "t", 5);
+PARAM_DOUBLE_IN("alpha", "The desired success probability.", "a", 0.95);
PARAM_FLAG("naive", "If true, sampling will be done without using a tree.",
"N");
PARAM_FLAG("single_mode", "If true, single-tree search is used (as opposed to "
More information about the mlpack-git
mailing list