sgd_test_function.hpp
Go to the documentation of this file.
1 
12 #ifndef MLPACK_CORE_OPTIMIZERS_PROBLEMS_SGD_TEST_FUNCTION_HPP
13 #define MLPACK_CORE_OPTIMIZERS_PROBLEMS_SGD_TEST_FUNCTION_HPP
14 
15 #include <mlpack/prereqs.hpp>
16 
17 namespace mlpack {
18 namespace optimization {
19 namespace test {
20 
26 {
27  private:
28  arma::Col<size_t> visitationOrder;
29 
30  public:
33 
37  void Shuffle();
38 
40  size_t NumFunctions() const { return 3; }
41 
43  arma::mat GetInitialPoint() const { return arma::mat("6; -45.6; 6.2"); }
44 
46  double Evaluate(const arma::mat& coordinates, const size_t i) const;
47 
49  double Evaluate(const arma::mat& coordinates,
50  const size_t begin,
51  const size_t batchSize) const;
52 
54  void Gradient(const arma::mat& coordinates,
55  const size_t i,
56  arma::mat& gradient) const;
57 
59  void Gradient(const arma::mat& coordinates,
60  const size_t begin,
61  arma::mat& gradient,
62  const size_t batchSize) const;
63 };
64 
65 } // namespace test
66 } // namespace optimization
67 } // namespace mlpack
68 
69 #endif
Very, very simple test function which is the composite of three other functions.
size_t NumFunctions() const
Return 3 (the number of functions).
.hpp
Definition: add_to_po.hpp:21
The core includes that mlpack expects; standard C++ includes and Armadillo.
SGDTestFunction()
Initialize the SGDTestFunction.
void Shuffle()
Shuffle the order of function visitation.
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.
double Evaluate(const arma::mat &coordinates, const size_t i) const
Evaluate a function.