This wrapper serves for adapting the interface of the cross-validation classes to the one that can be utilized by the mlpack optimizers.
More...
#include <cv_function.hpp>
|
| CVFunction (CVType &cv, data::DatasetMapper< data::IncrementPolicy, double > &datasetInfo, const double relativeDelta, const double minDelta, const BoundArgs &... args) |
| Initialize a CVFunction object. More...
|
|
double | Evaluate (const arma::mat ¶meters) |
| Run cross-validation with the bound and passed parameters. More...
|
|
void | Gradient (const arma::mat ¶meters, arma::mat &gradient) |
| Evaluate numerically the gradient of the CVFunction with the given parameters. More...
|
|
MLAlgorithm & | BestModel () |
| Access and modify the best model so far.
|
|
template<size_t BoundArgIndex, size_t ParamIndex, typename... Args, typename > |
double | Evaluate (const arma::mat ¶meters, const Args &... args) |
|
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
-
CVType | A cross-validation strategy. |
MLAlgorithm | The machine learning algorithm used in cross-validation. |
TotalArgs | The total number of arguments that are supposed to be passed to the Evaluate method of a CVType object. |
BoundArgs | Types 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. |
◆ CVFunction()
template<typename CVType , typename MLAlgorithm , size_t TotalArgs, typename... BoundArgs>
Initialize a CVFunction object.
- Parameters
-
cv | A cross-validation object. |
datasetInfo | Information on each parameter (categorical/numeric). Contains mappings from optimizer-passed size_t indices to double values that should be used. |
relativeDelta | Relative 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). |
minDelta | Minimum 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. |
args | Arguments 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. |
◆ Evaluate()
template<typename CVType , typename MLAlgorithm , size_t TotalArgs, typename... BoundArgs>
double mlpack::hpt::CVFunction< CVType, MLAlgorithm, TotalArgs, BoundArgs >::Evaluate |
( |
const arma::mat & |
parameters | ) |
|
Run cross-validation with the bound and passed parameters.
- Parameters
-
parameters | Arguments (rather than the bound arguments) that should be passed into the Evaluate method of the CVType object. |
◆ Gradient()
template<typename CVType , typename MLAlgorithm , size_t TotalArgs, typename... BoundArgs>
void mlpack::hpt::CVFunction< CVType, MLAlgorithm, TotalArgs, BoundArgs >::Gradient |
( |
const arma::mat & |
parameters, |
|
|
arma::mat & |
gradient |
|
) |
| |
Evaluate numerically the gradient of the CVFunction with the given parameters.
- Parameters
-
parameters | Arguments (rather than the bound arguments) that should be passed into the Evaluate method of the CVType object. |
gradient | Vector to output the gradient into. |
The documentation for this class was generated from the following files: