split_data.hpp File Reference
Include dependency graph for split_data.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 mlpack
 
Linear algebra utility functions, generally performed on matrices or vectors.
 
 mlpack::data
 
Functions to load and save matrices and models.
 

Functions

template<typename T , typename LabelsType , typename = std::enable_if_t<arma::is_arma_type<LabelsType>::value>>
void Split (const arma::Mat< T > &input, const LabelsType &inputLabel, arma::Mat< T > &trainData, arma::Mat< T > &testData, LabelsType &trainLabel, LabelsType &testLabel, const double testRatio, const bool shuffleData=true)
 Given an input dataset and labels, split into a training set and test set. More...

 
template
<
typename
T
>
void Split (const arma::Mat< T > &input, arma::Mat< T > &trainData, arma::Mat< T > &testData, const double testRatio, const bool shuffleData=true)
 Given an input dataset, split into a training set and test set. More...

 
template<typename T , typename LabelsType , typename = std::enable_if_t<arma::is_arma_type<LabelsType>::value>>
std::tuple< arma::Mat< T >, arma::Mat< T >, LabelsType, LabelsType > Split (const arma::Mat< T > &input, const LabelsType &inputLabel, const double testRatio, const bool shuffleData=true, const bool stratifyData=false)
 Given an input dataset and labels, split into a training set and test set. More...

 
template
<
typename
T
>
std::tuple< arma::Mat< T >, arma::Mat< T > > Split (const arma::Mat< T > &input, const double testRatio, const bool shuffleData=true)
 Given an input dataset, split into a training set and test set. More...

 
template<typename FieldType , typename T , typename = std::enable_if_t< arma::is_Col<typename FieldType::object_type>::value || arma::is_Mat_only<typename FieldType::object_type>::value>>
void Split (const FieldType &input, const arma::field< T > &inputLabel, FieldType &trainData, arma::field< T > &trainLabel, FieldType &testData, arma::field< T > &testLabel, const double testRatio, const bool shuffleData=true)
 Given an input dataset and labels, split into a training set and test set. More...

 
template<class FieldType , class = std::enable_if_t< arma::is_Col<typename FieldType::object_type>::value || arma::is_Mat_only<typename FieldType::object_type>::value>>
void Split (const FieldType &input, FieldType &trainData, FieldType &testData, const double testRatio, const bool shuffleData=true)
 Given an input dataset, split into a training set and test set. More...

 
template<class FieldType , typename T , class = std::enable_if_t< arma::is_Col<typename FieldType::object_type>::value || arma::is_Mat_only<typename FieldType::object_type>::value>>
std::tuple< FieldType, FieldType, arma::field< T >, arma::field< T > > Split (const FieldType &input, const arma::field< T > &inputLabel, const double testRatio, const bool shuffleData=true)
 Given an input dataset and labels, split into a training set and test set. More...

 
template<class FieldType , class = std::enable_if_t< arma::is_Col<typename FieldType::object_type>::value || arma::is_Mat_only<typename FieldType::object_type>::value>>
std::tuple< FieldType, FieldType > Split (const FieldType &input, const double testRatio, const bool shuffleData=true)
 Given an input dataset, split into a training set and test set. More...

 
template
<
typename
InputType
>
void SplitHelper (const InputType &input, InputType &train, InputType &test, const double testRatio, const arma::uvec &order=arma::uvec())
 This helper function splits any input data into training and testing parts. More...

 
template<typename T , typename LabelsType , typename = std::enable_if_t<arma::is_arma_type<LabelsType>::value>>
void StratifiedSplit (const arma::Mat< T > &input, const LabelsType &inputLabel, arma::Mat< T > &trainData, arma::Mat< T > &testData, LabelsType &trainLabel, LabelsType &testLabel, const double testRatio, const bool shuffleData=true)
 Given an input dataset and labels, stratify into a training set and test set. More...

 

Detailed Description

Author
Tham Ngap Wei, Keon Kim

Defines Split(), a utility function to split a dataset into a training set and a test set.

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.

Definition in file split_data.hpp.