- enable on per default
git-svn-id: http://moon:8086/svn/software/trunk/projects/Rbm@657 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
+19
-24
@@ -44,7 +44,7 @@ RbmComponent::RbmComponent (const std::string &name, size_t id, size_t numVisibl
|
|||||||
m_toggleEnable->setTooltip (TRANS("Enable layer for up pass"));
|
m_toggleEnable->setTooltip (TRANS("Enable layer for up pass"));
|
||||||
m_toggleEnable->setButtonText (TRANS("Enable"));
|
m_toggleEnable->setButtonText (TRANS("Enable"));
|
||||||
m_toggleEnable->addListener (this);
|
m_toggleEnable->addListener (this);
|
||||||
|
m_toggleEnable->setToggleState(true, NotificationType::dontSendNotification);
|
||||||
redrawWeights();
|
redrawWeights();
|
||||||
|
|
||||||
setSize (430, 130);
|
setSize (430, 130);
|
||||||
@@ -54,23 +54,15 @@ RbmComponent::RbmComponent (const std::string &name, size_t id, size_t numVisibl
|
|||||||
|
|
||||||
RbmComponent::~RbmComponent()
|
RbmComponent::~RbmComponent()
|
||||||
{
|
{
|
||||||
//[Destructor_pre]. You can add your own custom destruction code here..
|
|
||||||
//[/Destructor_pre]
|
|
||||||
|
|
||||||
//[Destructor]. You can add your own custom destruction code here..
|
|
||||||
DrawTraining = nullptr;
|
DrawTraining = nullptr;
|
||||||
DrawReconstruction = nullptr;
|
DrawReconstruction = nullptr;
|
||||||
DrawWeights = nullptr;
|
DrawWeights = nullptr;
|
||||||
DrawHidden = nullptr;
|
DrawHidden = nullptr;
|
||||||
//[/Destructor]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
void RbmComponent::paint (Graphics& g)
|
void RbmComponent::paint (Graphics& g)
|
||||||
{
|
{
|
||||||
//[UserPrePaint] Add your own custom painting code here..
|
|
||||||
//[/UserPrePaint]
|
|
||||||
|
|
||||||
g.fillAll (Colours::white);
|
g.fillAll (Colours::white);
|
||||||
|
|
||||||
g.setColour (Colours::black);
|
g.setColour (Colours::black);
|
||||||
@@ -133,8 +125,6 @@ void RbmComponent::paint (Graphics& g)
|
|||||||
408, 354, 96, 14,
|
408, 354, 96, 14,
|
||||||
Justification::centred, true);
|
Justification::centred, true);
|
||||||
|
|
||||||
//[UserPaint] Add your own custom painting code here..
|
|
||||||
//[/UserPaint]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RbmComponent::resized()
|
void RbmComponent::resized()
|
||||||
@@ -212,11 +202,11 @@ void RbmComponent::buttonClicked(Button* buttonThatWasClicked)
|
|||||||
{
|
{
|
||||||
if (buttonThatWasClicked == m_toggleEnable)
|
if (buttonThatWasClicked == m_toggleEnable)
|
||||||
{
|
{
|
||||||
bool state = isEnabled();
|
bool state = buttonThatWasClicked->getToggleState();
|
||||||
if (next)
|
if (next)
|
||||||
{
|
{
|
||||||
RbmComponent *pComp = static_cast<RbmComponent*> (next);
|
RbmComponent *pComp = static_cast<RbmComponent*> (next);
|
||||||
pComp->enable(state);
|
pComp->m_toggleEnable->setToggleState(state, NotificationType::sendNotification);
|
||||||
}
|
}
|
||||||
redrawReconstruction();
|
redrawReconstruction();
|
||||||
}
|
}
|
||||||
@@ -229,15 +219,24 @@ void RbmComponent::redrawReconstruction()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RbmComponent::gibbs(const arma::mat& v)
|
||||||
|
{
|
||||||
|
arma::mat r = v;
|
||||||
|
for (int i=0; i < params().numGibbs; i++)
|
||||||
|
{
|
||||||
|
DrawHidden->getData() = toHiddenProbs(r);
|
||||||
|
r = toVisibleProbs(DrawHidden->getData());
|
||||||
|
}
|
||||||
|
DrawReconstruction->getData() = r;
|
||||||
|
DrawReconstruction->DrawData();
|
||||||
|
DrawHidden->DrawData();
|
||||||
|
}
|
||||||
|
|
||||||
void RbmComponent::upPass(const arma::mat& v)
|
void RbmComponent::upPass(const arma::mat& v)
|
||||||
{
|
{
|
||||||
DrawTraining->getData() = v;
|
DrawTraining->getData() = v;
|
||||||
DrawTraining->DrawData();
|
DrawTraining->DrawData();
|
||||||
DrawHidden->getData() = toHiddenProbs(v);
|
gibbs(v);
|
||||||
DrawHidden->DrawData();
|
|
||||||
DrawReconstruction->getData() = toVisibleProbs(DrawHidden->getData());
|
|
||||||
DrawReconstruction->DrawData();
|
|
||||||
|
|
||||||
if (next)
|
if (next)
|
||||||
{
|
{
|
||||||
RbmComponent *pComp = static_cast<RbmComponent*> (next);
|
RbmComponent *pComp = static_cast<RbmComponent*> (next);
|
||||||
@@ -262,15 +261,11 @@ void RbmComponent::upDownPass(const arma::mat& v)
|
|||||||
{
|
{
|
||||||
DrawTraining->getData() = v;
|
DrawTraining->getData() = v;
|
||||||
DrawTraining->DrawData();
|
DrawTraining->DrawData();
|
||||||
DrawHidden->getData() = toHiddenProbs(v);
|
gibbs(v);
|
||||||
DrawHidden->DrawData();
|
|
||||||
DrawReconstruction->getData() = toVisibleProbs(DrawHidden->getData());
|
|
||||||
DrawReconstruction->DrawData();
|
|
||||||
|
|
||||||
if (next)
|
if (next)
|
||||||
{
|
{
|
||||||
RbmComponent *pComp = static_cast<RbmComponent*> (next);
|
RbmComponent *pComp = static_cast<RbmComponent*> (next);
|
||||||
if (pComp->isEnabled())
|
if (pComp->m_toggleEnable->getToggleState())
|
||||||
{
|
{
|
||||||
pComp->upDownPass(DrawHidden->getData());
|
pComp->upDownPass(DrawHidden->getData());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,16 +78,8 @@ private:
|
|||||||
ScopedPointer<DrawComponent> DrawReconstruction;
|
ScopedPointer<DrawComponent> DrawReconstruction;
|
||||||
ScopedPointer<DrawComponent> DrawWeights;
|
ScopedPointer<DrawComponent> DrawWeights;
|
||||||
ScopedPointer<ToggleButton> m_toggleEnable;
|
ScopedPointer<ToggleButton> m_toggleEnable;
|
||||||
bool isEnabled()
|
|
||||||
{
|
|
||||||
return m_toggleEnable->getToggleState();
|
|
||||||
}
|
|
||||||
|
|
||||||
void enable(bool state)
|
|
||||||
{
|
|
||||||
m_toggleEnable->setToggleState(state, NotificationType::sendNotification);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
void gibbs(const arma::mat& v);
|
||||||
size_t m_currWeightIndexToDraw;
|
size_t m_currWeightIndexToDraw;
|
||||||
void onDraw(DrawComponent &obj) override;
|
void onDraw(DrawComponent &obj) override;
|
||||||
void buttonClicked(Button* buttonThatWasClicked) override;
|
void buttonClicked(Button* buttonThatWasClicked) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user