- use custom noise for bugfixing

- init weights with zero mean uniform noise

git-svn-id: http://moon:8086/svn/software/trunk/projects/Rbm@598 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2019-10-29 07:00:59 +00:00
parent 595be173b1
commit a061fdf0da
5 changed files with 147 additions and 14 deletions
+6 -4
View File
@@ -18,6 +18,7 @@
#include <armadillo>
#include <jsoncpp/json/json.h>
#include "noise.h"
class Rbm
{
@@ -108,11 +109,11 @@ public:
}
};
Rbm(size_t numVisible, size_t numHidden, double weightInit=0.01);
Rbm(size_t numVisible, size_t numHidden);
Rbm(const Rbm& orig);
virtual ~Rbm();
void weightsInit(double mu, double stddev);
void weightsInit(double stddev, double mu=0.0);
void train(arma::mat const &batch, size_t miniBatchSize, size_t numEpochs, IListener *pListener);
arma::mat toHiddenState(const arma::mat &visible) const;
@@ -128,16 +129,17 @@ public:
private:
const Params m_params;
double m_weightInit;
arma::mat sample(arma::mat const &src);
static arma::mat probsLogistic(arma::mat const &src);
void uniform(arma::mat &srcDst, double mu=0.0, double stdDev=1.0);
void uniform(arma::mat &srcDst, double stdDev=1.0, double mu=0.5);
protected:
arma::mat m_w;
arma::mat m_bh;
arma::mat m_bv;
private:
noise_gen_t m_noise;
};
#endif /* RBM_HPP */