Files
Rbm-legacy/Source/VisibleLayer.hpp
T
2014-10-16 18:35:32 +00:00

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_ */