- 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:
2019-11-11 18:25:39 +00:00
parent 7a79b48e5c
commit c800033993
2 changed files with 85 additions and 98 deletions
+19 -24
View File
@@ -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->setButtonText (TRANS("Enable"));
m_toggleEnable->addListener (this);
m_toggleEnable->setToggleState(true, NotificationType::dontSendNotification);
redrawWeights();
setSize (430, 130);
@@ -54,23 +54,15 @@ RbmComponent::RbmComponent (const std::string &name, size_t id, size_t numVisibl
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;
DrawReconstruction = nullptr;
DrawWeights = nullptr;
DrawHidden = nullptr;
//[/Destructor]
}
//==============================================================================
void RbmComponent::paint (Graphics& g)
{
//[UserPrePaint] Add your own custom painting code here..
//[/UserPrePaint]
g.fillAll (Colours::white);
g.setColour (Colours::black);
@@ -133,8 +125,6 @@ void RbmComponent::paint (Graphics& g)
408, 354, 96, 14,
Justification::centred, true);
//[UserPaint] Add your own custom painting code here..
//[/UserPaint]
}
void RbmComponent::resized()
@@ -212,11 +202,11 @@ void RbmComponent::buttonClicked(Button* buttonThatWasClicked)
{
if (buttonThatWasClicked == m_toggleEnable)
{
bool state = isEnabled();
bool state = buttonThatWasClicked->getToggleState();
if (next)
{
RbmComponent *pComp = static_cast<RbmComponent*> (next);
pComp->enable(state);
pComp->m_toggleEnable->setToggleState(state, NotificationType::sendNotification);
}
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)
{
DrawTraining->getData() = v;
DrawTraining->DrawData();
DrawHidden->getData() = toHiddenProbs(v);
DrawHidden->DrawData();
DrawReconstruction->getData() = toVisibleProbs(DrawHidden->getData());
DrawReconstruction->DrawData();
gibbs(v);
if (next)
{
RbmComponent *pComp = static_cast<RbmComponent*> (next);
@@ -262,15 +261,11 @@ void RbmComponent::upDownPass(const arma::mat& v)
{
DrawTraining->getData() = v;
DrawTraining->DrawData();
DrawHidden->getData() = toHiddenProbs(v);
DrawHidden->DrawData();
DrawReconstruction->getData() = toVisibleProbs(DrawHidden->getData());
DrawReconstruction->DrawData();
gibbs(v);
if (next)
{
RbmComponent *pComp = static_cast<RbmComponent*> (next);
if (pComp->isEnabled())
if (pComp->m_toggleEnable->getToggleState())
{
pComp->upDownPass(DrawHidden->getData());
}
+1 -9
View File
@@ -78,16 +78,8 @@ private:
ScopedPointer<DrawComponent> DrawReconstruction;
ScopedPointer<DrawComponent> DrawWeights;
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;
void onDraw(DrawComponent &obj) override;
void buttonClicked(Button* buttonThatWasClicked) override;