diff --git a/source/RbmComponent.cpp b/source/RbmComponent.cpp index 176d655..5ddc3b2 100644 --- a/source/RbmComponent.cpp +++ b/source/RbmComponent.cpp @@ -54,6 +54,12 @@ RbmComponent::RbmComponent (const std::string &name, size_t id, size_t numVisibl m_toggleEnable->setButtonText (TRANS("Enable")); m_toggleEnable->addListener (this); m_toggleEnable->setToggleState(true, NotificationType::dontSendNotification); + + addAndMakeVisible (m_buttonCopyH2C = new TextButton ("Copy hidden state to context")); + m_buttonCopyH2C->setTooltip (TRANS("Copy hidden state to context input")); + m_buttonCopyH2C->setButtonText (TRANS("H2C")); + m_buttonCopyH2C->addListener (this); + redrawWeights(); setSize (m_sizeX, m_sizeY); @@ -69,6 +75,7 @@ RbmComponent::~RbmComponent() DrawHidden = nullptr; DrawContextTrain = nullptr; DrawContextReconst = nullptr; + m_buttonCopyH2C = nullptr; } //============================================================================== @@ -147,6 +154,7 @@ void RbmComponent::resized() DrawContextReconst->setBoundsRelative (0, 140./m_sizeY, 430./m_sizeX, 20./m_sizeY); DrawHidden->setBoundsRelative (0, 170./m_sizeY, 430./m_sizeX, 20./m_sizeY); m_toggleEnable->setBoundsRelative (330./m_sizeX, 0, 80./m_sizeX, 24./m_sizeY); + m_buttonCopyH2C->setBoundsRelative (330./m_sizeX, 30./m_sizeY, 80./m_sizeX, 24./m_sizeY); } void RbmComponent::mouseMove (const MouseEvent& e) @@ -237,6 +245,11 @@ void RbmComponent::buttonClicked(Button* buttonThatWasClicked) } } redrawReconstruction(); + } + else if (buttonThatWasClicked == m_buttonCopyH2C) + { + DrawContextTrain->getData() = DrawHidden->getData(); + upDownPass(getTraining()); } } @@ -244,7 +257,6 @@ void RbmComponent::redrawReconstruction() { RbmComponent *pComp = static_cast (root()); pComp->upDownPass(pComp->getTraining()); - } void RbmComponent::gibbs(const arma::mat& vc) diff --git a/source/RbmComponent.hpp b/source/RbmComponent.hpp index 7cd71c3..798117d 100644 --- a/source/RbmComponent.hpp +++ b/source/RbmComponent.hpp @@ -84,6 +84,8 @@ private: ScopedPointer DrawContextReconst; ScopedPointer DrawWeights; ScopedPointer m_toggleEnable; + ScopedPointer m_buttonCopyH2C; + void gibbs(const arma::mat& v); size_t m_currWeightIndexToDraw; void onDraw(DrawComponent &obj) override;