mlpack  master
regularized_svd.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_METHODS_REGULARIZED_SVD_REGULARIZED_SVD_HPP
14 #define MLPACK_METHODS_REGULARIZED_SVD_REGULARIZED_SVD_HPP
15 
16 #include <mlpack/prereqs.hpp>
18 #include <mlpack/methods/cf/cf.hpp>
19 
21 
22 namespace mlpack {
23 namespace svd {
24 
58 template<
59  template<typename> class OptimizerType = mlpack::optimization::SGD
60 >
62 {
63  public:
64 
75  RegularizedSVD(const size_t iterations = 10,
76  const double alpha = 0.01,
77  const double lambda = 0.02);
78 
87  void Apply(const arma::mat& data,
88  const size_t rank,
89  arma::mat& u,
90  arma::mat& v);
91 
92  private:
94  size_t iterations;
96  double alpha;
98  double lambda;
99 };
100 
101 } // namespace svd
102 } // namespace mlpack
103 
104 namespace mlpack {
105 namespace cf {
106 
108 template<>
110 {
111  public:
113  static const bool UsesCoordinateList = true;
114 };
115 
116 } // namespace cf
117 } // namespace mlpack
118 
119 // Include implementation.
120 #include "regularized_svd_impl.hpp"
121 
122 #endif
size_t iterations
Number of optimization iterations.
Regularized SVD is a matrix factorization technique that seeks to reduce the error on the training se...
RegularizedSVD(const size_t iterations=10, const double alpha=0.01, const double lambda=0.02)
Constructor for Regularized SVD.
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 lambda
Regularization parameter for the optimization.
double alpha
Learning rate for the SGD optimizer.
void Apply(const arma::mat &data, const size_t rank, arma::mat &u, arma::mat &v)
Obtains the user and item matrices using the provided data and rank.
Stochastic Gradient Descent is a technique for minimizing a function which can be expressed as a sum ...
Definition: sgd.hpp:76
Template class for factorizer traits.
Definition: cf.hpp:39