CVFunction< CVType, MLAlgorithm, TotalArgs, BoundArgs > Class Template Reference

This wrapper serves for adapting the interface of the cross-validation classes to the one that can be utilized by the mlpack optimizers. More...

Public Member Functions

 CVFunction (CVType &cv, data::DatasetMapper< data::IncrementPolicy, double > &datasetInfo, const double relativeDelta, const double minDelta, const BoundArgs &... args)
 Initialize a CVFunction object. More...

 
MLAlgorithm & BestModel ()
 Access and modify the best model so far. More...

 
double Evaluate (const arma::mat &parameters)
 Run cross-validation with the bound and passed parameters. More...

 
void Gradient (const arma::mat &parameters, arma::mat &gradient)
 Evaluate numerically the gradient of the CVFunction with the given parameters. More...

 

Detailed Description


template<typename CVType, typename MLAlgorithm, size_t TotalArgs, typename... BoundArgs>
class mlpack::hpt::CVFunction< CVType, MLAlgorithm, TotalArgs, BoundArgs >

This wrapper serves for adapting the interface of the cross-validation classes to the one that can be utilized by the mlpack optimizers.

This class is not supposed to be used directly by users. To tune hyper-parameters see HyperParameterTuner.

Template Parameters
CVTypeA cross-validation strategy.
MLAlgorithmThe machine learning algorithm used in cross-validation.
TotalArgsThe total number of arguments that are supposed to be passed to the Evaluate method of a CVType object.
BoundArgsTypes of arguments (wrapped into the BoundArg struct) that should be passed into the Evaluate method of a CVType object but are not going to be passed into the Evaluate method of a CVFunction object.

Definition at line 39 of file cv_function.hpp.

Constructor & Destructor Documentation

◆ CVFunction()

CVFunction ( CVType &  cv,
data::DatasetMapper< data::IncrementPolicy, double > &  datasetInfo,
const double  relativeDelta,
const double  minDelta,
const BoundArgs &...  args 
)

Initialize a CVFunction object.

Parameters
cvA cross-validation object.
datasetInfoInformation on each parameter (categorical/numeric). Contains mappings from optimizer-passed size_t indices to double values that should be used.
relativeDeltaRelative increase of arguments for calculation of partial derivatives (by the definition). The exact increase for some particular argument is equal to the absolute value of the argument multiplied by the relative increase (see also the documentation for the minDelta parameter).
minDeltaMinimum increase of arguments for calculation of partial derivatives (by the definition). This value is going to be used when it is greater than the increase calculated with the rules described in the documentation for the relativeDelta parameter.
argsArguments that should be passed into the Evaluate method of the CVType object but are not going to be passed into the Evaluate method of this object.

Member Function Documentation

◆ BestModel()

MLAlgorithm& BestModel ( )
inline

Access and modify the best model so far.

Definition at line 87 of file cv_function.hpp.

References CVFunction< CVType, MLAlgorithm, TotalArgs, BoundArgs >::Evaluate().

◆ Evaluate()

double Evaluate ( const arma::mat &  parameters)

Run cross-validation with the bound and passed parameters.

Parameters
parametersArguments (rather than the bound arguments) that should be passed into the Evaluate method of the CVType object.

Referenced by CVFunction< CVType, MLAlgorithm, TotalArgs, BoundArgs >::BestModel().

◆ Gradient()

void Gradient ( const arma::mat &  parameters,
arma::mat &  gradient 
)

Evaluate numerically the gradient of the CVFunction with the given parameters.

Parameters
parametersArguments (rather than the bound arguments) that should be passed into the Evaluate method of the CVType object.
gradientVector to output the gradient into.

The documentation for this class was generated from the following file:
  • /home/ryan/src/mlpack.org/_src/mlpack-git/src/mlpack/core/hpt/cv_function.hpp