mlpack  master
test_function.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_CORE_OPTIMIZERS_SGD_TEST_FUNCTION_HPP
13 #define MLPACK_CORE_OPTIMIZERS_SGD_TEST_FUNCTION_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 
17 namespace mlpack {
18 namespace optimization {
19 namespace test {
20 
26 {
27  public:
30 
32  size_t NumFunctions() const { return 3; }
33 
35  arma::mat GetInitialPoint() const { return arma::mat("6; -45.6; 6.2"); }
36 
38  double Evaluate(const arma::mat& coordinates, const size_t i) const;
39 
41  void Gradient(const arma::mat& coordinates,
42  const size_t i,
43  arma::mat& gradient) const;
44 };
45 
46 } // namespace test
47 } // namespace optimization
48 } // namespace mlpack
49 
50 #endif
Very, very simple test function which is the composite of three other functions.
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: binarize.hpp:18
The core includes that mlpack expects; standard C++ includes and Armadillo.
double Evaluate(const arma::mat &coordinates, const size_t i) const
Evaluate a function.
SGDTestFunction()
Nothing to do for the constructor.
arma::mat GetInitialPoint() const
Get the starting point.
void Gradient(const arma::mat &coordinates, const size_t i, arma::mat &gradient) const
Evaluate the gradient of a function.
size_t NumFunctions() const
Return 3 (the number of functions).