- train(): added reconstruction error metric
- train2(): - added reconstruction error metric. - added Gaussian units - added sparsity - GUI: choose train() or train2() git-svn-id: http://moon:8086/svn/software/trunk/projects/RBM@44 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -280,6 +280,10 @@ MainComponent::MainComponent ()
|
||||
weightInitLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
|
||||
weightInitLabel->addListener (this);
|
||||
|
||||
addAndMakeVisible (rbmTrainV2ToggleButton = new ToggleButton ("rbmTrainV2ToggleButton toggle button"));
|
||||
rbmTrainV2ToggleButton->setButtonText (TRANS("Train Ver. 2"));
|
||||
rbmTrainV2ToggleButton->addListener (this);
|
||||
|
||||
|
||||
//[UserPreSize]
|
||||
m_vNumX = 16;
|
||||
@@ -340,6 +344,7 @@ MainComponent::~MainComponent()
|
||||
momentumLabel = nullptr;
|
||||
sparsityLearningRateLabel = nullptr;
|
||||
weightInitLabel = nullptr;
|
||||
rbmTrainV2ToggleButton = nullptr;
|
||||
|
||||
|
||||
//[Destructor]. You can add your own custom destruction code here..
|
||||
@@ -461,6 +466,7 @@ void MainComponent::resized()
|
||||
momentumLabel->setBounds (208, 368, 72, 24);
|
||||
sparsityLearningRateLabel->setBounds (416, 320, 72, 24);
|
||||
weightInitLabel->setBounds (416, 368, 72, 24);
|
||||
rbmTrainV2ToggleButton->setBounds (336, 200, 128, 24);
|
||||
//[UserResized] Add your own custom resize handling here..
|
||||
DrawTraining->setBounds (16, 16, 100, 100);
|
||||
DrawReconstruction->setBounds (110+16, 16, 100, 100);
|
||||
@@ -618,6 +624,11 @@ void MainComponent::buttonClicked (Button* buttonThatWasClicked)
|
||||
m_pRbm->setDoSparse(buttonThatWasClicked->getToggleState());
|
||||
//[/UserButtonCode_rbmDoSparseToggleButton]
|
||||
}
|
||||
else if (buttonThatWasClicked == rbmTrainV2ToggleButton)
|
||||
{
|
||||
//[UserButtonCode_rbmTrainV2ToggleButton] -- add your button handler code here..
|
||||
//[/UserButtonCode_rbmTrainV2ToggleButton]
|
||||
}
|
||||
|
||||
//[UserbuttonClicked_Post]
|
||||
//[/UserbuttonClicked_Post]
|
||||
@@ -848,8 +859,8 @@ void MainComponent::redrawReconstruction()
|
||||
{
|
||||
DrawHidden->setData(m_pRbm->toHidden(DrawTraining->getData()));
|
||||
DrawReconstruction->setData(m_pRbm->toVisible(DrawHidden->getData()));
|
||||
double energy = m_pRbm->getEnergy(DrawTraining->getData(), DrawHidden->getData());
|
||||
cout << "Energy(" << 0 <<") = " << energy << endl;
|
||||
// double energy = m_pRbm->getEnergy(DrawTraining->getData(), DrawHidden->getData());
|
||||
// cout << "Energy(" << 0 <<") = " << energy << endl;
|
||||
|
||||
}
|
||||
|
||||
@@ -862,8 +873,14 @@ void MainComponent::redrawWeights(int index)
|
||||
void MainComponent::run()
|
||||
{
|
||||
trainButton->setEnabled(false);
|
||||
m_pRbm->train(m_layers, numEpochslabel->getText().getIntValue());
|
||||
// m_pRbm->train2(m_layers, numEpochslabel->getText().getIntValue(), 100);
|
||||
if (rbmTrainV2ToggleButton->getToggleState())
|
||||
{
|
||||
m_pRbm->train2(m_layers, numEpochslabel->getText().getIntValue(), 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pRbm->train(m_layers, numEpochslabel->getText().getIntValue());
|
||||
}
|
||||
trainButton->setEnabled(true);
|
||||
}
|
||||
|
||||
@@ -1046,6 +1063,10 @@ BEGIN_JUCER_METADATA
|
||||
edBkgCol="0" labelText="0.001" editableSingleClick="1" editableDoubleClick="1"
|
||||
focusDiscardsChanges="0" fontname="Default font" fontsize="15"
|
||||
bold="0" italic="0" justification="36"/>
|
||||
<TOGGLEBUTTON name="rbmTrainV2ToggleButton toggle button" id="92c647c1f8b110a2"
|
||||
memberName="rbmTrainV2ToggleButton" virtualName="" explicitFocusOrder="0"
|
||||
pos="336 200 128 24" buttonText="Train Ver. 2" connectedEdges="0"
|
||||
needsCallback="1" radioGroupId="0" state="0"/>
|
||||
</JUCER_COMPONENT>
|
||||
|
||||
END_JUCER_METADATA
|
||||
|
||||
Reference in New Issue
Block a user