MLPACK  1.0.10
simple_weight_update.hpp
Go to the documentation of this file.
1 
22 #ifndef _MLPACK_METHODS_PERCEPTRON_LEARNING_POLICIES_SIMPLE_WEIGHT_UPDATE_HPP
23 #define _MLPACK_METHODS_PERCEPTRON_LEARNING_POLICIES_SIMPLE_WEIGHT_UPDATE_HPP
24 
25 #include <mlpack/core.hpp>
26 
37 namespace mlpack {
38 namespace perceptron {
39 
41 {
42  public:
55  void UpdateWeights(const arma::mat& trainData,
56  arma::mat& weightVectors,
57  const size_t labelIndex,
58  const size_t vectorIndex,
59  const size_t rowIndex,
60  const arma::rowvec& D)
61  {
62  weightVectors.row(rowIndex) = weightVectors.row(rowIndex) -
63  D(labelIndex) * trainData.col(labelIndex).t();
64 
65  weightVectors.row(vectorIndex) = weightVectors.row(vectorIndex) +
66  D(labelIndex) * trainData.col(labelIndex).t();
67  }
68 };
69 
70 }; // namespace perceptron
71 }; // namespace mlpack
72 
73 #endif