[RBM]
- removed classes HiddenLayer.hpp and VisibleLayer.hpp - fixed warnings - RbmComponent inherits Rbm - improved Rbm::train - use gaussion weight initialization git-svn-id: http://moon:8086/svn/software/trunk/projects/RBM@297 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
+10
-55
@@ -42,9 +42,7 @@ public:
|
||||
}
|
||||
|
||||
virtual void batchchanged() = 0;
|
||||
virtual void toHidden(RowVectorXd &h, RowVectorXd const &v) = 0;
|
||||
virtual void toVisible(RowVectorXd &v, RowVectorXd const &h) = 0;
|
||||
virtual void downPass(RowVectorXd &h) = 0;
|
||||
virtual void downPass(RowVectorXd &dst, RowVectorXd const &src) = 0;
|
||||
virtual void upPass(RowVectorXd const &v) = 0;
|
||||
void registerRbm(IRbmComponent *pObj)
|
||||
{
|
||||
@@ -72,10 +70,10 @@ public:
|
||||
Describe your class and how it works here!
|
||||
//[/Comments]
|
||||
*/
|
||||
class RbmComponent : public Component,
|
||||
public RbmListener,
|
||||
public DrawListener,
|
||||
public IRbmComponent
|
||||
class RbmComponent : public Component
|
||||
, public Rbm
|
||||
, public DrawListener
|
||||
, public IRbmComponent
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
@@ -97,21 +95,6 @@ public:
|
||||
void mouseDoubleClick (const MouseEvent& e) override;
|
||||
void mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel) override;
|
||||
|
||||
void setDoLearnVariance(bool value);
|
||||
void setDoRaoBlackwell(bool enable);
|
||||
void setUseProbsForHiddenReconstruction(bool enable);
|
||||
void setUseVisibleGaussian(bool enable);
|
||||
void setDoSparse(bool enable);
|
||||
void setNormalizeData(bool enable);
|
||||
void setLambda(double value);
|
||||
void setSigmaDecay(double value);
|
||||
void setWeightDecay(double value);
|
||||
void setSparsity(double value);
|
||||
void setNumGibbs(size_t value);
|
||||
void setSigma(double value);
|
||||
void setMuWeights(double value);
|
||||
void setMuSparsity(double value);
|
||||
void setMomentum(double value);
|
||||
void batchchanged() override;
|
||||
void setWeightsIndex(size_t index);
|
||||
size_t getWeightsIndex();
|
||||
@@ -119,47 +102,19 @@ public:
|
||||
void setTrainingIndex(size_t index);
|
||||
size_t getTrainingIndex();
|
||||
|
||||
void copyReconstructionToTraining();
|
||||
void redrawWeights();
|
||||
void redrawReconstruction();
|
||||
void redrawVariances();
|
||||
void train(size_t numEpochs);
|
||||
RowVectorXd const& getTrainingData();
|
||||
MatrixXd const& getHiddenBatch()
|
||||
{
|
||||
return m_pRbm->getHiddenBatch();
|
||||
}
|
||||
|
||||
Rbm::Params const& params()
|
||||
{
|
||||
return m_pRbm->params();
|
||||
}
|
||||
|
||||
void reconstructVisible(RowVectorXd& dst, const RowVectorXd& src)
|
||||
void downPass(RowVectorXd &dst, RowVectorXd const &src) override
|
||||
{
|
||||
toHidden(DrawHidden->getData(), src);
|
||||
toVisible(dst, DrawHidden->getData());
|
||||
DrawHidden->DrawData();
|
||||
}
|
||||
|
||||
void toVisible(RowVectorXd &v, RowVectorXd const &h) override
|
||||
{
|
||||
m_pRbm->toVisible(v, h);
|
||||
}
|
||||
|
||||
void toHidden(RowVectorXd &h, RowVectorXd const &v) override
|
||||
{
|
||||
m_pRbm->toHidden(h, v);
|
||||
if (lower)
|
||||
{
|
||||
lower->downPass(h);
|
||||
lower->downPass(DrawHidden->getData(), DrawHidden->getData());
|
||||
}
|
||||
}
|
||||
|
||||
void downPass(RowVectorXd& h) override
|
||||
{
|
||||
toHidden(DrawHidden->getData(), h);
|
||||
m_pRbm->toVisible(h, DrawHidden->getData());
|
||||
toVisible(dst, DrawHidden->getData());
|
||||
DrawHidden->DrawData();
|
||||
}
|
||||
|
||||
@@ -175,7 +130,6 @@ public:
|
||||
|
||||
private:
|
||||
//[UserVariables] -- You can add your own custom variables in this section.
|
||||
ScopedPointer<Rbm> m_pRbm;
|
||||
Weights &m_weights;
|
||||
RbmComponentListener &m_listener;
|
||||
ScopedPointer<DrawComponent> DrawTraining;
|
||||
@@ -185,7 +139,8 @@ private:
|
||||
ScopedPointer<DrawComponent> DrawHidden;
|
||||
size_t m_currWeightIndexToDraw;
|
||||
size_t m_currTrainingIndexToDraw;
|
||||
void onProgressChanged(const Rbm &obj) override;
|
||||
void onParamsChanged() override;
|
||||
void onProgressChanged() override;
|
||||
void onDraw(DrawComponent &obj) override;
|
||||
//[/UserVariables]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user