12 #ifndef MLPACK_CORE_HPT_CV_FUNCTION_HPP 13 #define MLPACK_CORE_HPT_CV_FUNCTION_HPP 35 template<
typename CVType,
38 typename... BoundArgs>
64 const double relativeDelta,
65 const double minDelta,
66 const BoundArgs&... args);
74 double Evaluate(
const arma::mat& parameters);
84 void Gradient(
const arma::mat& parameters, arma::mat& gradient);
91 using BoundArgsTupleType = std::tuple<BoundArgs...>;
94 static const size_t BoundArgsAmount =
95 std::tuple_size<BoundArgsTupleType>::value;
102 template<
size_t BoundArgIndex,
104 bool BoundArgsIndexInRange = (BoundArgIndex < BoundArgsAmount)>
114 BoundArgsTupleType boundArgs;
117 double bestObjective;
120 MLAlgorithm bestModel;
123 double relativeDelta;
131 template<
size_t BoundArgIndex,
135 std::enable_if<(BoundArgIndex + ParamIndex < TotalArgs)>::type>
136 inline double Evaluate(
const arma::mat& parameters,
const Args&... args);
141 template<
size_t BoundArgIndex,
145 std::enable_if<BoundArgIndex + ParamIndex == TotalArgs>::type,
147 inline double Evaluate(
const arma::mat& parameters,
const Args&... args);
152 template<
size_t BoundArgIndex,
155 typename =
typename std::enable_if<
156 UseBoundArg<BoundArgIndex, ParamIndex>::value>::type>
157 inline double PutNextArg(
const arma::mat& parameters,
const Args&... args);
163 template<
size_t BoundArgIndex,
166 typename =
typename std::enable_if<
167 !UseBoundArg<BoundArgIndex, ParamIndex>::value>::type,
169 inline double PutNextArg(
const arma::mat& parameters,
const Args&... args);
177 #include "cv_function_impl.hpp" Auxiliary information for a dataset, including mappings to/from strings (or other types) and the data...
MLAlgorithm & BestModel()
Access and modify the best model so far.
Linear algebra utility functions, generally performed on matrices or vectors.
CVFunction(CVType &cv, data::DatasetMapper< data::IncrementPolicy, double > &datasetInfo, const double relativeDelta, const double minDelta, const BoundArgs &... args)
Initialize a CVFunction object.
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.