MachineIntelligenceCore:NeuralNets
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
HebbianRule.hpp
Go to the documentation of this file.
1 
25 #ifndef HEBBIAN_HPP_
26 #define HEBBIAN_HPP_
27 
29 
30 namespace mic {
31 namespace neural_nets {
32 namespace learning {
33 
42 template <typename eT=float>
44 public:
50  HebbianRule(size_t rows_, size_t cols_) {
51  delta = MAKE_MATRIX_PTR(eT, rows_, cols_);
52  delta->zeros();
53  }
54 
55  // Virtual destructor - empty.
56  virtual ~HebbianRule() { }
57 
58 
65  virtual mic::types::MatrixPtr<eT> calculateUpdate(mic::types::MatrixPtr<eT> x_, mic::types::MatrixPtr<eT> y_, eT learning_rate_) {
66  // delta + alpha * x * y.
67  (*delta) = learning_rate_ * (*y_) * ((*x_).transpose());
68 
69  return delta;
70  }
71 
72 
73 protected:
75  mic::types::MatrixPtr<eT> delta;
76 
77 };
78 
79 } //: namespace learning
80 } /* namespace neural_nets */
81 } /* namespace mic */
82 
83 #endif /* HEBBIAN_HPP_ */
mic::types::MatrixPtr< eT > delta
Calculated update.
Definition: HebbianRule.hpp:75
HebbianRule(size_t rows_, size_t cols_)
Definition: HebbianRule.hpp:50
Abstract class representing interface to optimization function.
Updates according to classical Hebbian rule (wij += ni * x * y).
Definition: HebbianRule.hpp:43
virtual mic::types::MatrixPtr< eT > calculateUpdate(mic::types::MatrixPtr< eT > x_, mic::types::MatrixPtr< eT > y_, eT learning_rate_)
Definition: HebbianRule.hpp:65