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 ¶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... | |
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.
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. |
Definition at line 39 of file 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.
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. |
|
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().
double Evaluate | ( | const arma::mat & | parameters | ) |
Run cross-validation with the bound and passed parameters.
parameters | Arguments (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().
void Gradient | ( | const arma::mat & | parameters, |
arma::mat & | gradient | ||
) |
Evaluate numerically the gradient of the CVFunction with the given 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. |