58 RealMatrix m_weightMatrix;
122 parameters += m_hiddenNeurons.numberOfParameters();
123 parameters += m_visibleNeurons.numberOfParameters();
129 return to_vector(m_weightMatrix)
130 | m_hiddenNeurons.parameterVector()
131 | m_visibleNeurons.parameterVector();
139 std::size_t endH = endW + m_hiddenNeurons.numberOfParameters();
140 std::size_t endV = endH + m_visibleNeurons.numberOfParameters();
141 noalias(to_vector(m_weightMatrix)) = subrange(newParameters,0,endW);
142 m_hiddenNeurons.setParameterVector(subrange(newParameters,endW,endH));
143 m_visibleNeurons.setParameterVector(subrange(newParameters,endH,endV));
152 m_weightMatrix.clear();
160 return m_hiddenNeurons;
164 return m_hiddenNeurons;
168 return m_visibleNeurons;
172 return m_visibleNeurons;
177 return m_weightMatrix;
181 return m_weightMatrix;
207 m_evalMean = evalMean;
227 return boost::shared_ptr<State>(
new EmptyState());
244 evalForward(patterns,outputs);
247 evalBackward(patterns,outputs);
253 eval(patterns,outputs);
260 void inputHidden(RealMatrix& inputs, RealMatrix
const& visibleStates)
const{
261 SIZE_CHECK(visibleStates.size1() == inputs.size1());
262 SIZE_CHECK(inputs.size2() == m_hiddenNeurons.size());
263 SIZE_CHECK( visibleStates.size2() == m_visibleNeurons.size());
265 noalias(inputs) = prod(m_visibleNeurons.phi(visibleStates),trans(m_weightMatrix));
273 void inputVisible(RealMatrix& inputs, RealMatrix
const& hiddenStates)
const{
274 SIZE_CHECK(hiddenStates.size1() == inputs.size1());
275 SIZE_CHECK(inputs.size2() == m_visibleNeurons.size());
277 noalias(inputs) = prod(m_hiddenNeurons.phi(hiddenStates),m_weightMatrix);
285 return m_hiddenNeurons.size();
289 return m_visibleNeurons.size();
294 archive >> m_weightMatrix;
295 archive >> m_hiddenNeurons;
296 archive >> m_visibleNeurons;
302 std::stringstream stream(str);
308 archive << m_weightMatrix;
309 archive << m_hiddenNeurons;
310 archive << m_visibleNeurons;
312 std::stringstream stream;
314 std::string str = stream.str();