- added clear button for clearing the stack
- create: use numHidden from prev. layer for numVisible of layer to be created - fixed enable/disable of layers git-svn-id: http://moon:8086/svn/software/trunk/projects/Rbm@665 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -113,9 +113,15 @@ MainComponent::MainComponent (const String prjname)
|
|||||||
numHiddenLabel->addListener (this);
|
numHiddenLabel->addListener (this);
|
||||||
|
|
||||||
addAndMakeVisible (createButton = new TextButton ("Create button"));
|
addAndMakeVisible (createButton = new TextButton ("Create button"));
|
||||||
|
createButton->setTooltip (TRANS("Create new layer"));
|
||||||
createButton->setButtonText (TRANS("Create"));
|
createButton->setButtonText (TRANS("Create"));
|
||||||
createButton->addListener (this);
|
createButton->addListener (this);
|
||||||
|
|
||||||
|
addAndMakeVisible (clearButton = new TextButton ("Clear button"));
|
||||||
|
clearButton->setTooltip (TRANS("Delete all layers"));
|
||||||
|
clearButton->setButtonText (TRANS("Clear"));
|
||||||
|
clearButton->addListener (this);
|
||||||
|
|
||||||
addAndMakeVisible (projectNameLabel = new Label ("Project Name label",
|
addAndMakeVisible (projectNameLabel = new Label ("Project Name label",
|
||||||
m_file.getFileNameWithoutExtension()));
|
m_file.getFileNameWithoutExtension()));
|
||||||
projectNameLabel->setFont (Font (15.00f, Font::plain));
|
projectNameLabel->setFont (Font (15.00f, Font::plain));
|
||||||
@@ -324,6 +330,7 @@ MainComponent::~MainComponent()
|
|||||||
numVisibleLabel = nullptr;
|
numVisibleLabel = nullptr;
|
||||||
numHiddenLabel = nullptr;
|
numHiddenLabel = nullptr;
|
||||||
createButton = nullptr;
|
createButton = nullptr;
|
||||||
|
clearButton = nullptr;
|
||||||
projectNameLabel = nullptr;
|
projectNameLabel = nullptr;
|
||||||
loadButton = nullptr;
|
loadButton = nullptr;
|
||||||
saveButton = nullptr;
|
saveButton = nullptr;
|
||||||
@@ -440,17 +447,19 @@ void MainComponent::resized()
|
|||||||
WeightsSlider->setBounds (896, 320, 220, 24);
|
WeightsSlider->setBounds (896, 320, 220, 24);
|
||||||
numEpochslabel->setBounds (564, 200, 72, 24);
|
numEpochslabel->setBounds (564, 200, 72, 24);
|
||||||
learningRateLabel->setBounds (652, 200, 72, 24);
|
learningRateLabel->setBounds (652, 200, 72, 24);
|
||||||
numVisibleLabel->setBounds (656, 248, 48, 24);
|
|
||||||
numHiddenLabel->setBounds (780, 248, 48, 24);
|
|
||||||
createButton->setBounds (728, 280, 72, 24);
|
|
||||||
projectNameLabel->setBounds (552, 248, 96, 24);
|
projectNameLabel->setBounds (552, 248, 96, 24);
|
||||||
|
numVisibleLabel->setBounds (648, 248, 48, 24);
|
||||||
|
numVisibleYLabel->setBounds (700, 248, 48, 24);
|
||||||
|
numHiddenLabel->setBounds (748, 248, 48, 24);
|
||||||
|
m_rbmSelect->setBounds (810, 248, 62, 24);
|
||||||
loadButton->setBounds (564, 280, 72, 24);
|
loadButton->setBounds (564, 280, 72, 24);
|
||||||
saveButton->setBounds (644, 280, 72, 24);
|
saveButton->setBounds (644, 280, 72, 24);
|
||||||
numVisibleYLabel->setBounds (716, 248, 48, 24);
|
createButton->setBounds (724, 280, 72, 24);
|
||||||
|
clearButton->setBounds (804, 280, 72, 24);
|
||||||
loadTrainingButton->setBounds (564, 316, 72, 24);
|
loadTrainingButton->setBounds (564, 316, 72, 24);
|
||||||
saveTrainingButton->setBounds (644, 316, 72, 24);
|
saveTrainingButton->setBounds (644, 316, 72, 24);
|
||||||
clearTrainingButton->setBounds (804, 316, 72, 24);
|
|
||||||
removeTrainingButton->setBounds (724, 316, 72, 24);
|
removeTrainingButton->setBounds (724, 316, 72, 24);
|
||||||
|
clearTrainingButton->setBounds (804, 316, 72, 24);
|
||||||
numGibbsSlider->setBounds (896, 240, 220, 24);
|
numGibbsSlider->setBounds (896, 240, 220, 24);
|
||||||
rbmDoRaoBlackwellToggleButton->setBounds (556, 60, 112, 24);
|
rbmDoRaoBlackwellToggleButton->setBounds (556, 60, 112, 24);
|
||||||
rbmDoSampleVisibleToggleButton->setBounds (680, 60, 128, 24);
|
rbmDoSampleVisibleToggleButton->setBounds (680, 60, 128, 24);
|
||||||
@@ -467,7 +476,6 @@ void MainComponent::resized()
|
|||||||
weightInitLabel->setBounds (948, 200, 72, 24);
|
weightInitLabel->setBounds (948, 200, 72, 24);
|
||||||
rbmLearnVarianceButton->setBounds (1004, 92, 128, 24);
|
rbmLearnVarianceButton->setBounds (1004, 92, 128, 24);
|
||||||
rbmNormalizeDataToggleButton->setBounds (1004, 60, 124, 24);
|
rbmNormalizeDataToggleButton->setBounds (1004, 60, 124, 24);
|
||||||
m_rbmSelect->setBounds (812, 280, 62, 24);
|
|
||||||
rbmDoSampleBatch->setBounds (844, 60, 128, 24);
|
rbmDoSampleBatch->setBounds (844, 60, 128, 24);
|
||||||
sizeMiniBatch->setBounds (1064, 20, 48, 24);
|
sizeMiniBatch->setBounds (1064, 20, 48, 24);
|
||||||
rbmUseHiddenGaussianToggleButton->setBounds (840, 92, 156, 24);
|
rbmUseHiddenGaussianToggleButton->setBounds (840, 92, 156, 24);
|
||||||
@@ -520,11 +528,22 @@ void MainComponent::buttonClicked (Button* buttonThatWasClicked)
|
|||||||
{
|
{
|
||||||
m_stack = new Stack(m_file.getParentDirectory().getFullPathName().toStdString(), std::string(projectNameLabel->getText().getCharPointer()));
|
m_stack = new Stack(m_file.getParentDirectory().getFullPathName().toStdString(), std::string(projectNameLabel->getText().getCharPointer()));
|
||||||
}
|
}
|
||||||
|
Layer *pPrev = m_stack->getLayer(next_index-1);
|
||||||
|
if (pPrev)
|
||||||
|
{
|
||||||
|
numVisX = pPrev->bh().n_elem;
|
||||||
|
numVisY = 1;
|
||||||
|
}
|
||||||
m_stack->addLayer(onConstruct("Layer", next_index, numVisX, numVisY, numHid));
|
m_stack->addLayer(onConstruct("Layer", next_index, numVisX, numVisY, numHid));
|
||||||
m_rbmSelect->addItem(String(next_index), next_index+1);
|
m_rbmSelect->addItem(String(next_index), next_index+1);
|
||||||
m_rbmSelect->setSelectedId(next_index+1, sendNotification);
|
m_rbmSelect->setSelectedId(next_index+1, sendNotification);
|
||||||
//[/UserButtonCode_createButton]
|
//[/UserButtonCode_createButton]
|
||||||
}
|
}
|
||||||
|
else if (buttonThatWasClicked == clearButton)
|
||||||
|
{
|
||||||
|
m_stack = nullptr;
|
||||||
|
m_rbmSelect->clear(NotificationType::dontSendNotification);
|
||||||
|
}
|
||||||
else if (buttonThatWasClicked == loadButton)
|
else if (buttonThatWasClicked == loadButton)
|
||||||
{
|
{
|
||||||
//[UserButtonCode_loadButton] -- add your button handler code here..
|
//[UserButtonCode_loadButton] -- add your button handler code here..
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ private:
|
|||||||
ScopedPointer<Label> numVisibleLabel;
|
ScopedPointer<Label> numVisibleLabel;
|
||||||
ScopedPointer<Label> numHiddenLabel;
|
ScopedPointer<Label> numHiddenLabel;
|
||||||
ScopedPointer<TextButton> createButton;
|
ScopedPointer<TextButton> createButton;
|
||||||
|
ScopedPointer<TextButton> clearButton;
|
||||||
ScopedPointer<Label> projectNameLabel;
|
ScopedPointer<Label> projectNameLabel;
|
||||||
ScopedPointer<TextButton> loadButton;
|
ScopedPointer<TextButton> loadButton;
|
||||||
ScopedPointer<TextButton> saveButton;
|
ScopedPointer<TextButton> saveButton;
|
||||||
|
|||||||
+14
-3
@@ -203,10 +203,21 @@ void RbmComponent::buttonClicked(Button* buttonThatWasClicked)
|
|||||||
if (buttonThatWasClicked == m_toggleEnable)
|
if (buttonThatWasClicked == m_toggleEnable)
|
||||||
{
|
{
|
||||||
bool state = buttonThatWasClicked->getToggleState();
|
bool state = buttonThatWasClicked->getToggleState();
|
||||||
if (next)
|
if (state)
|
||||||
{
|
{
|
||||||
RbmComponent *pComp = static_cast<RbmComponent*> (next);
|
if (prev)
|
||||||
pComp->m_toggleEnable->setToggleState(state, NotificationType::sendNotification);
|
{
|
||||||
|
RbmComponent *pComp = static_cast<RbmComponent*> (prev);
|
||||||
|
pComp->m_toggleEnable->setToggleState(state, NotificationType::sendNotification);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (next)
|
||||||
|
{
|
||||||
|
RbmComponent *pComp = static_cast<RbmComponent*> (next);
|
||||||
|
pComp->m_toggleEnable->setToggleState(state, NotificationType::sendNotification);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
redrawReconstruction();
|
redrawReconstruction();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user