- 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:
2019-11-13 18:53:04 +00:00
parent 24f253e892
commit fecf93a012
3 changed files with 40 additions and 9 deletions
+25 -6
View File
@@ -113,9 +113,15 @@ MainComponent::MainComponent (const String prjname)
numHiddenLabel->addListener (this);
addAndMakeVisible (createButton = new TextButton ("Create button"));
createButton->setTooltip (TRANS("Create new layer"));
createButton->setButtonText (TRANS("Create"));
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",
m_file.getFileNameWithoutExtension()));
projectNameLabel->setFont (Font (15.00f, Font::plain));
@@ -324,6 +330,7 @@ MainComponent::~MainComponent()
numVisibleLabel = nullptr;
numHiddenLabel = nullptr;
createButton = nullptr;
clearButton = nullptr;
projectNameLabel = nullptr;
loadButton = nullptr;
saveButton = nullptr;
@@ -440,17 +447,19 @@ void MainComponent::resized()
WeightsSlider->setBounds (896, 320, 220, 24);
numEpochslabel->setBounds (564, 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);
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);
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);
saveTrainingButton->setBounds (644, 316, 72, 24);
clearTrainingButton->setBounds (804, 316, 72, 24);
removeTrainingButton->setBounds (724, 316, 72, 24);
clearTrainingButton->setBounds (804, 316, 72, 24);
numGibbsSlider->setBounds (896, 240, 220, 24);
rbmDoRaoBlackwellToggleButton->setBounds (556, 60, 112, 24);
rbmDoSampleVisibleToggleButton->setBounds (680, 60, 128, 24);
@@ -467,7 +476,6 @@ void MainComponent::resized()
weightInitLabel->setBounds (948, 200, 72, 24);
rbmLearnVarianceButton->setBounds (1004, 92, 128, 24);
rbmNormalizeDataToggleButton->setBounds (1004, 60, 124, 24);
m_rbmSelect->setBounds (812, 280, 62, 24);
rbmDoSampleBatch->setBounds (844, 60, 128, 24);
sizeMiniBatch->setBounds (1064, 20, 48, 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()));
}
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_rbmSelect->addItem(String(next_index), next_index+1);
m_rbmSelect->setSelectedId(next_index+1, sendNotification);
//[/UserButtonCode_createButton]
}
else if (buttonThatWasClicked == clearButton)
{
m_stack = nullptr;
m_rbmSelect->clear(NotificationType::dontSendNotification);
}
else if (buttonThatWasClicked == loadButton)
{
//[UserButtonCode_loadButton] -- add your button handler code here..