- fully refactored traning

- removed non working stuff

git-svn-id: http://moon:8086/svn/software/trunk/projects/RBM@553 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2019-10-17 18:58:12 +00:00
parent b46c65c492
commit 0f2fe2b315
4 changed files with 105 additions and 284 deletions
+13 -34
View File
@@ -485,6 +485,14 @@ void MainComponent::buttonClicked (Button* buttonThatWasClicked)
if (buttonThatWasClicked == trainButton)
{
//[UserButtonCode_trainButton] -- add your button handler code here..
if (rbmNormalizeDataToggleButton->getToggleState() == true)
{
m_trainingData = Rbm::normalizeData(m_layers.data());
}
else
{
m_trainingData = m_layers.data();
}
startThread();
//[/UserButtonCode_trainButton]
}
@@ -565,33 +573,21 @@ void MainComponent::buttonClicked (Button* buttonThatWasClicked)
else if (buttonThatWasClicked == rbmUseVisibleGaussianToggleButton)
{
//[UserButtonCode_rbmUseVisibleGaussianToggleButton] -- add your button handler code here..
m_pRbmComponentCurr->setUseVisibleGaussian(buttonThatWasClicked->getToggleState());
m_pRbmComponentCurr->redrawReconstruction();
//[/UserButtonCode_rbmUseVisibleGaussianToggleButton]
}
else if (buttonThatWasClicked == rbmDoSparseToggleButton)
{
//[UserButtonCode_rbmDoSparseToggleButton] -- add your button handler code here..
m_pRbmComponentCurr->setDoSparse(buttonThatWasClicked->getToggleState());
//[/UserButtonCode_rbmDoSparseToggleButton]
}
else if (buttonThatWasClicked == rbmLearnVarianceButton)
{
//[UserButtonCode_rbmLearnVarianceButton] -- add your button handler code here..
m_pRbmComponentCurr->setDoLearnVariance(buttonThatWasClicked->getToggleState());
if (!buttonThatWasClicked->getToggleState())
{
m_pRbmComponentCurr->setConstantSigma(sigmaLabel->getText().getFloatValue());
}
//[/UserButtonCode_rbmLearnVarianceButton]
}
else if (buttonThatWasClicked == rbmNormalizeDataToggleButton)
{
//[UserButtonCode_rbmNormalizeDataToggleButton] -- add your button handler code here..
m_pRbmComponentCurr->setNormalizeData(buttonThatWasClicked->getToggleState());
m_pRbmComponentCurr->batchchanged();
m_pRbmComponentCurr->redrawWeights();
m_pRbmComponentCurr->redrawReconstruction();
//[/UserButtonCode_rbmNormalizeDataToggleButton]
}
else if (buttonThatWasClicked == rbmDoSampleBatch)
@@ -603,8 +599,7 @@ void MainComponent::buttonClicked (Button* buttonThatWasClicked)
else if (buttonThatWasClicked == rbmUseHiddenGaussianToggleButton)
{
//[UserButtonCode_rbmUseHiddenGaussianToggleButton] -- add your button handler code here..
m_pRbmComponentCurr->setUseHiddenGaussian(buttonThatWasClicked->getToggleState());
//[/UserButtonCode_rbmUseHiddenGaussianToggleButton]
//[/UserButtonCode_rbmUseHiddenGaussianToggleButton]
}
//[UserbuttonClicked_Post]
@@ -683,27 +678,22 @@ void MainComponent::labelTextChanged (Label* labelThatHasChanged)
else if (labelThatHasChanged == lambdaLabel)
{
//[UserLabelCode_lambdaLabel] -- add your label text handling code here..
m_pRbmComponentCurr->setLambda(labelThatHasChanged->getText().getFloatValue());
m_pRbmComponentCurr->redrawReconstruction();
//[/UserLabelCode_lambdaLabel]
}
else if (labelThatHasChanged == sigmaLabel)
{
//[UserLabelCode_sigmaLabel] -- add your label text handling code here..
m_pRbmComponentCurr->setConstantSigma(labelThatHasChanged->getText().getFloatValue());
//[/UserLabelCode_sigmaLabel]
}
else if (labelThatHasChanged == sparsityLabel)
{
//[UserLabelCode_sparsityLabel] -- add your label text handling code here..
m_pRbmComponentCurr->setSparsity(labelThatHasChanged->getText().getFloatValue());
//[/UserLabelCode_sparsityLabel]
}
else if (labelThatHasChanged == sigmaDecayLabel)
{
//[UserLabelCode_sigmaDecayLabel] -- add your label text handling code here..
m_pRbmComponentCurr->setSigmaDecay(labelThatHasChanged->getText().getFloatValue());
//[/UserLabelCode_sigmaDecayLabel]
//[/UserLabelCode_sigmaDecayLabel]
}
else if (labelThatHasChanged == weightDecayLabel)
{
@@ -720,7 +710,6 @@ void MainComponent::labelTextChanged (Label* labelThatHasChanged)
else if (labelThatHasChanged == sparsityLearningRateLabel)
{
//[UserLabelCode_sparsityLearningRateLabel] -- add your label text handling code here..
m_pRbmComponentCurr->setMuSparsity(labelThatHasChanged->getText().getFloatValue());
//[/UserLabelCode_sparsityLearningRateLabel]
}
else if (labelThatHasChanged == weightInitLabel)
@@ -843,7 +832,7 @@ void MainComponent::create(juce::String const &projectName)
{
m_weights[id] = new Weights(numVisibleLabel->getText().getIntValue(), numVisibleYLabel->getText().getIntValue(), numHiddenLabel->getText().getIntValue());
}
addAndMakeVisible(m_pRbmComponent[id] = new RbmComponent(*m_weights[id], m_layers.data(), *this));
addAndMakeVisible(m_pRbmComponent[id] = new RbmComponent(*m_weights[id], m_trainingData, *this));
}
else
{
@@ -904,20 +893,10 @@ void MainComponent::updateControls()
rbmDoRaoBlackwellToggleButton->setToggleState(m_pRbmComponentCurr->params().m_doRaoBlackwell, dontSendNotification);
rbmDoSampleVisibleToggleButton->setToggleState(m_pRbmComponentCurr->params().m_doSampleVisible, dontSendNotification);
rbmDoSampleBatch->setToggleState(m_pRbmComponentCurr->params().m_doSampleBatch, dontSendNotification);
rbmUseVisibleGaussianToggleButton->setToggleState(m_pRbmComponentCurr->params().m_useVisibleGaussian, dontSendNotification);
rbmUseHiddenGaussianToggleButton->setToggleState(m_pRbmComponentCurr->params().m_useHiddenGaussian, dontSendNotification);
rbmDoSparseToggleButton->setToggleState(m_pRbmComponentCurr->params().m_doSparse, dontSendNotification);
rbmLearnVarianceButton->setToggleState(m_pRbmComponentCurr->params().m_doLearnVariance, dontSendNotification);
rbmDoSampleBatch->setToggleState(m_pRbmComponentCurr->params().m_doSampleBatch, dontSendNotification);
rbmNormalizeDataToggleButton->setToggleState(m_pRbmComponentCurr->params().m_doNormalizeData, dontSendNotification);
rbmDoSampleBatch->setToggleState(m_pRbmComponentCurr->params().m_doSampleBatch, dontSendNotification);
lambdaLabel->setText(String(m_pRbmComponentCurr->params().m_lambda), dontSendNotification);
sigmaDecayLabel->setText(String(m_pRbmComponentCurr->params().m_sigmaDecay), dontSendNotification);
weightDecayLabel->setText(String(m_pRbmComponentCurr->params().m_weightDecay), dontSendNotification);
sparsityLabel->setText(String(m_pRbmComponentCurr->params().m_sparsity), dontSendNotification);
sigmaLabel->setText(String(m_pRbmComponentCurr->params().m_constantSigma), dontSendNotification);
sparsityLearningRateLabel->setText(String(m_pRbmComponentCurr->params().m_muSparsity), dontSendNotification);
learningRateLabel->setText(String(m_pRbmComponentCurr->params().m_muWeights), dontSendNotification);
learningRateLabel->setText(String(m_pRbmComponentCurr->params().m_learningRate), dontSendNotification);
momentumLabel->setText(String(m_pRbmComponentCurr->params().m_momentum), dontSendNotification);
numVisibleLabel->setText(String(m_weightsCurr->getNumVisibleX()), dontSendNotification );
numVisibleYLabel->setText(String(m_weightsCurr->getNumVisibleY()), dontSendNotification );