[mlpack] [mlpack/mlpack] Automatic bindings step 3: model parameters (#825)

Ryan Curtin notifications at github.com
Mon Dec 5 20:58:25 EST 2016


This pull request is a lot of work that revamps the CLI system pretty thoroughly.  It's been the majority of what I've been working on recently, which is probably why it seems like my activity has been low. :)  General highlights:

 * Now we can use `PARAM_MODEL_IN()` and `PARAM_MODEL_OUT()` instead of `PARAM_STRING_IN("input_model_file", ...)` and `PARAM_STRING_OUT("output_model_file", ...)`.
 * `CLI::Destroy()` is now required at the end of programs that save model-type parameters.  This won't be a problem because in the long run the call to `CLI::Destroy()` will probably become automatically generated.
 * The way parameters of different types are dealt with by `CLI` is greatly simplified and split into many different files with standalone functions using SFINAE to achieve different behavior for different types.
 * All command-line programs except `mlpack_rmva` now use model parameters where applicable.  I would have done `mlpack_rmva` but @zoq suggested that it's about to be heavily revamped anyway.
 * No command-line programs except `mlpack_rmva` and the preprocessing programs use string options to represent files, meaning that the options at the top of a program are now basically abstracted away from files.  That will allow me to start writing code to turn these definitions into coherent bindings to other languages.

There is just a little more to do:

 * Fix failing CLI test.
 * Add tests for HoeffdingTreeModel.

But the PR is still reviewable as-is if anyone would like to.  I'll let this sit for a week or two after I push those last few changes then merge it in and continue onwards.  My goal (or rather my company's goal for me) is completed bindings for at least Python by January 1st, so... I'm doing my best to make that happen!
You can view, comment on, or merge this pull request online at:

  https://github.com/mlpack/mlpack/pull/825

-- Commit Summary --

  * Remove unneeded file.
  * Improve output and printing by giving each parameter its own function pointer to do that.
  * Add parameter type for serializable models.
  * Add first tests for serializable models.
  * Adapt a first program to load and save models.
  * Fix minor bugs in implementation.
  * Explicitly destroy the CLI object so that things are saved.
  * Remove created file.
  * Add an actual test for serializing models.
  * Update documentation for CLI.
  * Fix approx_kfn program types, transition to model parameters.
  * Refactor to clean up cli.hpp significantly.
  * Add functions for getting default type and string type.
  * Refactor AdaBoost to use model parameters.
  * Avoid copying objects unnecessarily.
  * Add copy constructor and move constructor.
  * Add copy and move constructors.
  * Transition some programs to use model parameters.
  * Refactor GMM programs; INPUT_MODEL_IN_REQ() does not exist yet.
  * Add required model parameters and tests.
  * Fix model parameter names, and call Destroy() on exit.
  * Incremental checkin to change computers.
  * Don't forget newlines at the end of output.
  * Finish transition for HMM programs.
  * Remove no-longer-needed bits.
  * Add copy/move constructor/assignment operators for LSHSearch.
  * Convert several more methods to use MODEL parameters.
  * Fix slightly off documentation.
  * Convert to model parameters for the last of the easy programs.
  * Um there's a tornado warning so I better commit this stuff, push it, and leave.
  * Add copy/move constructor and assignment operators to NeighborSearch, plus tests.
  * Fix bugs in move and copy constructors and operators.
  * Use MODEL types in KFN program.
  * Refactor mlpack_range_search to use MODEL parameters.
  * Adapt mlpack_krann to use model parameters.
  * Allow a parameter that can load a matrix with a DatasetInfo.
  * Add a test for loading DatasetInfo/mats.
  * Fix very important misspelling!
  * Add a model for easy serialization of HoeffdingTree.
  * Add a way to access parameters before they are loaded, and add tests.
  * Use different parameter type for test file.

-- File Changes --

    M src/mlpack/core/util/CMakeLists.txt (10)
    M src/mlpack/core/util/cli.cpp (169)
    M src/mlpack/core/util/cli.hpp (134)
    M src/mlpack/core/util/cli_impl.hpp (77)
    A src/mlpack/core/util/default_param.hpp (88)
    A src/mlpack/core/util/default_param_impl.hpp (108)
    D src/mlpack/core/util/option_impl.hpp (59)
    A src/mlpack/core/util/output_param.hpp (77)
    A src/mlpack/core/util/output_param_impl.hpp (94)
    M src/mlpack/core/util/param.hpp (150)
    A src/mlpack/core/util/param_data.hpp (256)
    A src/mlpack/core/util/param_data_impl.hpp (137)
    A src/mlpack/core/util/print_param.hpp (77)
    A src/mlpack/core/util/print_param_impl.hpp (71)
    A src/mlpack/core/util/string_type_param.hpp (87)
    A src/mlpack/core/util/string_type_param_impl.hpp (104)
    M src/mlpack/methods/adaboost/CMakeLists.txt (2)
    M src/mlpack/methods/adaboost/adaboost_main.cpp (149)
    A src/mlpack/methods/adaboost/adaboost_model.cpp (121)
    A src/mlpack/methods/adaboost/adaboost_model.hpp (112)
    M src/mlpack/methods/approx_kfn/approx_kfn_main.cpp (34)
    M src/mlpack/methods/cf/cf_main.cpp (22)
    M src/mlpack/methods/decision_stump/decision_stump_main.cpp (34)
    M src/mlpack/methods/det/det_main.cpp (28)
    M src/mlpack/methods/fastmks/fastmks.hpp (15)
    M src/mlpack/methods/fastmks/fastmks_impl.hpp (79)
    M src/mlpack/methods/fastmks/fastmks_main.cpp (20)
    M src/mlpack/methods/fastmks/fastmks_model.cpp (88)
    M src/mlpack/methods/fastmks/fastmks_model.hpp (9)
    M src/mlpack/methods/gmm/gmm_generate_main.cpp (7)
    M src/mlpack/methods/gmm/gmm_probability_main.cpp (7)
    M src/mlpack/methods/gmm/gmm_train_main.cpp (19)
    M src/mlpack/methods/hmm/CMakeLists.txt (3)
    M src/mlpack/methods/hmm/hmm_generate_main.cpp (28)
    M src/mlpack/methods/hmm/hmm_loglik_main.cpp (23)
    A src/mlpack/methods/hmm/hmm_model.hpp (172)
    M src/mlpack/methods/hmm/hmm_train_main.cpp (355)
    D src/mlpack/methods/hmm/hmm_util.hpp (44)
    D src/mlpack/methods/hmm/hmm_util_impl.hpp (175)
    M src/mlpack/methods/hmm/hmm_viterbi_main.cpp (23)
    M src/mlpack/methods/hoeffding_trees/CMakeLists.txt (2)
    M src/mlpack/methods/hoeffding_trees/hoeffding_tree_impl.hpp (2)
    M src/mlpack/methods/hoeffding_trees/hoeffding_tree_main.cpp (260)
    A src/mlpack/methods/hoeffding_trees/hoeffding_tree_model.cpp (288)
    A src/mlpack/methods/hoeffding_trees/hoeffding_tree_model.hpp (238)
    M src/mlpack/methods/lars/lars.hpp (2)
    M src/mlpack/methods/lars/lars_main.cpp (33)
    M src/mlpack/methods/linear_regression/linear_regression_main.cpp (38)
    M src/mlpack/methods/local_coordinate_coding/lcc.hpp (7)
    M src/mlpack/methods/local_coordinate_coding/local_coordinate_coding_main.cpp (45)
    M src/mlpack/methods/logistic_regression/logistic_regression.hpp (2)
    M src/mlpack/methods/logistic_regression/logistic_regression_main.cpp (28)
    M src/mlpack/methods/lsh/lsh_main.cpp (31)
    M src/mlpack/methods/lsh/lsh_search.hpp (55)
    M src/mlpack/methods/lsh/lsh_search_impl.hpp (110)
    M src/mlpack/methods/mean_shift/mean_shift_main.cpp (15)
    M src/mlpack/methods/naive_bayes/nbc_main.cpp (61)
    M src/mlpack/methods/neighbor_search/kfn_main.cpp (36)
    M src/mlpack/methods/neighbor_search/knn_main.cpp (42)
    M src/mlpack/methods/neighbor_search/neighbor_search.hpp (29)
    M src/mlpack/methods/neighbor_search/neighbor_search_impl.hpp (176)
    M src/mlpack/methods/neighbor_search/ns_model.hpp (32)
    M src/mlpack/methods/neighbor_search/ns_model_impl.hpp (73)
    M src/mlpack/methods/perceptron/perceptron.hpp (2)
    M src/mlpack/methods/perceptron/perceptron_impl.hpp (2)
    M src/mlpack/methods/perceptron/perceptron_main.cpp (114)
    M src/mlpack/methods/range_search/range_search.hpp (29)
    M src/mlpack/methods/range_search/range_search_impl.hpp (123)
    M src/mlpack/methods/range_search/range_search_main.cpp (34)
    M src/mlpack/methods/range_search/rs_model.cpp (175)
    M src/mlpack/methods/range_search/rs_model.hpp (28)
    M src/mlpack/methods/rann/krann_main.cpp (40)
    M src/mlpack/methods/rann/ra_model.hpp (28)
    M src/mlpack/methods/rann/ra_model_impl.hpp (162)
    M src/mlpack/methods/softmax_regression/softmax_regression.hpp (4)
    M src/mlpack/methods/softmax_regression/softmax_regression_impl.hpp (11)
    M src/mlpack/methods/softmax_regression/softmax_regression_main.cpp (54)
    M src/mlpack/methods/sparse_coding/sparse_coding.hpp (4)
    M src/mlpack/methods/sparse_coding/sparse_coding_main.cpp (46)
    M src/mlpack/tests/cli_test.cpp (317)
    M src/mlpack/tests/fastmks_test.cpp (117)
    M src/mlpack/tests/knn_test.cpp (162)
    M src/mlpack/tests/lsh_test.cpp (71)
    M src/mlpack/tests/range_search_test.cpp (255)
    M src/mlpack/tests/test_tools.hpp (26)

-- Patch Links --

https://github.com/mlpack/mlpack/pull/825.patch
https://github.com/mlpack/mlpack/pull/825.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/825
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://knife.lugatgt.org/pipermail/mlpack/attachments/20161205/d76bb913/attachment-0001.html>


More information about the mlpack mailing list