CVBase< MLAlgorithm, MatType, PredictionsType, WeightsType > Class Template Reference

An auxiliary class for cross-validation. More...

Public Types

using MIE = MetaInfoExtractor< MLAlgorithm, MatType, PredictionsType, WeightsType >
 A short alias for MetaInfoExtractor. More...

 

Public Member Functions

 CVBase ()
 Assert that MLAlgorithm doesn't take any additional basic parameters like numClasses. More...

 
 CVBase (const size_t numClasses)
 Assert that MLAlgorithm takes the numClasses parameter and store it. More...

 
 CVBase (const data::DatasetInfo &datasetInfo, const size_t numClasses)
 Assert that MLAlgorithm takes the numClasses parameter and a data::DatasetInfo parameter and store them. More...

 
template<typename... MLAlgorithmArgs>
MLAlgorithm Train (const MatType &xs, const PredictionsType &ys, const MLAlgorithmArgs &... args)
 Train MLAlgorithm with given data points, predictions, and hyperparameters depending on what CVBase constructor has been called. More...

 
template<typename... MLAlgorithmArgs>
MLAlgorithm Train (const MatType &xs, const PredictionsType &ys, const WeightsType &weights, const MLAlgorithmArgs &... args)
 Train MLAlgorithm with given data points, predictions, weights, and hyperparameters depending on what CVBase constructor has been called. More...

 

Static Public Member Functions

static void AssertDataConsistency (const MatType &xs, const PredictionsType &ys)
 Assert there is the equal number of data points and predictions. More...

 
static void AssertWeightsConsistency (const MatType &xs, const WeightsType &weights)
 Assert weighted learning is supported and there is the equal number of data points and weights. More...

 

Detailed Description


template
<
typename
MLAlgorithm
,
typename
MatType
,
typename
PredictionsType
,
typename
WeightsType
>

class mlpack::cv::CVBase< MLAlgorithm, MatType, PredictionsType, WeightsType >

An auxiliary class for cross-validation.

It serves to handle basic non-data constructor parameters of a machine learning algorithm (like datasetInfo or numClasses) and to assert that the machine learning algorithm and data satisfy certain conditions.

This class is not meant to be used directly by users. To cross-validate rather use end-user classes like SimpleCV or KFoldCV.

Template Parameters
MLAlgorithmA machine learning algorithm.
MatTypeThe type of data.
PredictionsTypeThe type of predictions (labels/responses).
WeightsTypeThe type of weights. It supposed to be void* when weights are not supported.

Definition at line 39 of file cv_base.hpp.

Member Typedef Documentation

◆ MIE

using MIE = MetaInfoExtractor<MLAlgorithm, MatType, PredictionsType, WeightsType>

A short alias for MetaInfoExtractor.

Definition at line 44 of file cv_base.hpp.

Constructor & Destructor Documentation

◆ CVBase() [1/3]

CVBase ( )

Assert that MLAlgorithm doesn't take any additional basic parameters like numClasses.

◆ CVBase() [2/3]

CVBase ( const size_t  numClasses)

Assert that MLAlgorithm takes the numClasses parameter and store it.

Parameters
numClassesNumber of classes in the dataset.

◆ CVBase() [3/3]

CVBase ( const data::DatasetInfo datasetInfo,
const size_t  numClasses 
)

Assert that MLAlgorithm takes the numClasses parameter and a data::DatasetInfo parameter and store them.

Parameters
datasetInfoType information for each dimension of the dataset.
numClassesNumber of classes in the dataset.

Member Function Documentation

◆ AssertDataConsistency()

static void AssertDataConsistency ( const MatType &  xs,
const PredictionsType &  ys 
)
static

Assert there is the equal number of data points and predictions.

◆ AssertWeightsConsistency()

static void AssertWeightsConsistency ( const MatType &  xs,
const WeightsType &  weights 
)
static

Assert weighted learning is supported and there is the equal number of data points and weights.

◆ Train() [1/2]

MLAlgorithm Train ( const MatType &  xs,
const PredictionsType &  ys,
const MLAlgorithmArgs &...  args 
)

Train MLAlgorithm with given data points, predictions, and hyperparameters depending on what CVBase constructor has been called.

◆ Train() [2/2]

MLAlgorithm Train ( const MatType &  xs,
const PredictionsType &  ys,
const WeightsType &  weights,
const MLAlgorithmArgs &...  args 
)

Train MLAlgorithm with given data points, predictions, weights, and hyperparameters depending on what CVBase constructor has been called.


The documentation for this class was generated from the following file:
  • /home/jenkins-mlpack/mlpack.org/_src/mlpack-3.2.1/src/mlpack/core/cv/cv_base.hpp