[mlpack-git] master: Merge pull request #1 from mlpack/master (8ad3b90)

gitdub at mlpack.org gitdub at mlpack.org
Tue May 31 04:47:01 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/1f562a1aba7ae55475afcc95659511c2b7f694e5...5b8fdce471328f722fcd8c0f22a6d995ce22c98b

>---------------------------------------------------------------

commit 8ad3b900bba6c8535ad94b5af31aaab1de0c64d1
Merge: 9e88669 1dad2b6
Author: Keon Kim <kwk236 at gmail.com>
Date:   Tue May 31 17:47:01 2016 +0900

    Merge pull request #1 from mlpack/master
    
    update


>---------------------------------------------------------------

8ad3b900bba6c8535ad94b5af31aaab1de0c64d1
 doc/guide/iodoc.hpp                                |   2 +-
 doc/tutorials/range_search/range_search.txt        |   8 +-
 src/mlpack/core/data/split_data.hpp                |   5 +-
 src/mlpack/core/tree/ballbound.hpp                 |  20 ++-
 src/mlpack/core/tree/ballbound_impl.hpp            |  94 +++++++--------
 src/mlpack/core/tree/binary_space_tree/typedef.hpp |   4 +-
 .../tree/rectangle_tree/r_star_tree_split_impl.hpp |  10 +-
 .../core/tree/rectangle_tree/r_tree_split_impl.hpp |   8 +-
 .../tree/rectangle_tree/rectangle_tree_impl.hpp    |   4 +-
 .../core/tree/rectangle_tree/x_tree_split_impl.hpp |  10 +-
 .../methods/neighbor_search/ns_model_impl.hpp      |   2 +-
 src/mlpack/methods/rmva/CMakeLists.txt             |   8 +-
 src/mlpack/tests/data/vc2_test.csv                 | 134 ++++++++++-----------
 src/mlpack/tests/serialization_test.cpp            |   4 +-
 14 files changed, 154 insertions(+), 159 deletions(-)

diff --cc src/mlpack/core/data/split_data.hpp
index 3979caf,1231095..e5f1e2e
--- a/src/mlpack/core/data/split_data.hpp
+++ b/src/mlpack/core/data/split_data.hpp
@@@ -149,40 -108,15 +149,43 @@@ Split(const arma::Mat<T>& input
    arma::Row<U> trainLabel;
    arma::Row<U> testLabel;
  
 -  TrainTestSplit(input, inputLabel, trainData, testData, trainLabel, testLabel,
 +  Split(input, inputLabel, trainData, testData, trainLabel, testLabel,
        testRatio);
  
-   return std::make_tuple(trainData, testData, trainLabel, testLabel);
+   return std::make_tuple(std::move(trainData),
+                          std::move(testData),
+                          std::move(trainLabel),
+                          std::move(testLabel));
  }
  
 +/**
 + * Given an input dataset, split into a training set and test set.
 + * Example usage below.  This overload returns the split dataset as a std::tuple
 + * with two elements: an arma::Mat<T> containing the training data and an
 + * arma::Mat<T> containing the test data.
 + *
 + * @code
 + * arma::mat input = loadData();
 + * auto splitResult = Split(input, 0.2);
 + * @endcode
 + *
 + * @param input Input dataset to split.
 + * @param testRatio Percentage of dataset to use for test set (between 0 and 1).
 + * @return std::tuple containing trainData (arma::Mat<T>)
 + *      and testData (arma::Mat<T>).
 + */
 +template<typename T>
 +std::tuple<arma::Mat<T>, arma::Mat<T>>
 +Split(const arma::Mat<T>& input,
 +      const double testRatio)
 +{
 +  arma::Mat<T> trainData;
 +  arma::Mat<T> testData;
 +  Split(input, trainData, testData, testRatio);
 +
 +  return std::make_tuple(std::move(trainData), std::move(testData));
 +}
 +
  } // namespace data
  } // namespace mlpack
  




More information about the mlpack-git mailing list