12 #ifndef MLPACK_CORE_HPT_CV_FUNCTION_HPP 13 #define MLPACK_CORE_HPT_CV_FUNCTION_HPP 35 template<
typename CVType,
38 typename... BoundArgs>
60 const double relativeDelta,
61 const double minDelta,
62 const BoundArgs&... args);
70 double Evaluate(
const arma::mat& parameters);
80 void Gradient(
const arma::mat& parameters, arma::mat& gradient);
87 using BoundArgsTupleType = std::tuple<BoundArgs...>;
90 static const size_t BoundArgsAmount =
91 std::tuple_size<BoundArgsTupleType>::value;
98 template<
size_t BoundArgIndex,
100 bool BoundArgsIndexInRange = (BoundArgIndex < BoundArgsAmount)>
107 BoundArgsTupleType boundArgs;
110 double bestObjective;
113 MLAlgorithm bestModel;
116 double relativeDelta;
124 template<
size_t BoundArgIndex,
128 std::enable_if<(BoundArgIndex + ParamIndex < TotalArgs)>::type>
129 inline double Evaluate(
const arma::mat& parameters,
const Args&... args);
134 template<
size_t BoundArgIndex,
138 std::enable_if<BoundArgIndex + ParamIndex == TotalArgs>::type,
140 inline double Evaluate(
const arma::mat& parameters,
const Args&... args);
145 template<
size_t BoundArgIndex,
148 typename =
typename std::enable_if<
149 UseBoundArg<BoundArgIndex, ParamIndex>::value>::type>
150 inline double PutNextArg(
const arma::mat& parameters,
const Args&... args);
156 template<
size_t BoundArgIndex,
159 typename =
typename std::enable_if<
160 !UseBoundArg<BoundArgIndex, ParamIndex>::value>::type,
162 inline double PutNextArg(
const arma::mat& parameters,
const Args&... args);
170 #include "cv_function_impl.hpp" MLAlgorithm & BestModel()
Access and modify the best model so far.
Include all of the base components required to write mlpack methods, and the main mlpack Doxygen docu...
double Evaluate(const arma::mat ¶meters)
Run cross-validation with the bound and passed parameters.
This wrapper serves for adapting the interface of the cross-validation classes to the one that can be...
void Gradient(const arma::mat ¶meters, arma::mat &gradient)
Evaluate numerically the gradient of the CVFunction with the given parameters.
CVFunction(CVType &cv, const double relativeDelta, const double minDelta, const BoundArgs &... args)
Initialize a CVFunction object.