git-svn-id: http://moon:8086/svn/software/trunk/projects/RBM@29 b431acfa-c32f-4a4a-93f1-934dc6c82436
47 lines
770 B
C++
47 lines
770 B
C++
/*
|
|
* VisibleLayer.hpp
|
|
*
|
|
* Created on: 21.09.2014
|
|
* Author: jens
|
|
*/
|
|
|
|
#ifndef VISIBLELAYER_HPP_
|
|
#define VISIBLELAYER_HPP_
|
|
|
|
#include "Layer.hpp"
|
|
#include <cmath>
|
|
|
|
class VisibleLayer : public Layer
|
|
{
|
|
public:
|
|
VisibleLayer(uint32_t numUnits = 0, const VectorXd *pStatesInit = nullptr)
|
|
: Layer(numUnits, pStatesInit)
|
|
{
|
|
}
|
|
|
|
virtual ~VisibleLayer()
|
|
{
|
|
}
|
|
|
|
double getEnergy(const Weights &weights)
|
|
{
|
|
double energy;
|
|
|
|
energy = -((Weights&)weights).visibleBias().transpose() * states();
|
|
|
|
return energy;
|
|
}
|
|
|
|
private:
|
|
double accum(Layer &layer, Weights &weights, uint32_t index)
|
|
{
|
|
double sum = ((Weights&)weights).visibleBias()[index];
|
|
|
|
sum += ((Weights&)weights).weights().row(index) * layer.states();
|
|
|
|
return sum;
|
|
}
|
|
};
|
|
|
|
#endif /* VISIBLELAYER_HPP_ */
|