- added data normalization

git-svn-id: http://moon:8086/svn/software/trunk/projects/RBM@45 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2014-11-12 13:08:20 +00:00
parent 6e7b8bc151
commit 549089a440
3 changed files with 62 additions and 0 deletions
+24
View File
@@ -284,6 +284,10 @@ MainComponent::MainComponent ()
rbmTrainV2ToggleButton->setButtonText (TRANS("Train Ver. 2"));
rbmTrainV2ToggleButton->addListener (this);
addAndMakeVisible (rbmNormalizeDataToggleButton = new ToggleButton ("rbmNormalizeData toggle button"));
rbmNormalizeDataToggleButton->setButtonText (TRANS("Normalize data"));
rbmNormalizeDataToggleButton->addListener (this);
//[UserPreSize]
m_vNumX = 16;
@@ -345,6 +349,7 @@ MainComponent::~MainComponent()
sparsityLearningRateLabel = nullptr;
weightInitLabel = nullptr;
rbmTrainV2ToggleButton = nullptr;
rbmNormalizeDataToggleButton = nullptr;
//[Destructor]. You can add your own custom destruction code here..
@@ -467,6 +472,7 @@ void MainComponent::resized()
sparsityLearningRateLabel->setBounds (416, 320, 72, 24);
weightInitLabel->setBounds (416, 368, 72, 24);
rbmTrainV2ToggleButton->setBounds (336, 200, 128, 24);
rbmNormalizeDataToggleButton->setBounds (336, 232, 160, 24);
//[UserResized] Add your own custom resize handling here..
DrawTraining->setBounds (16, 16, 100, 100);
DrawReconstruction->setBounds (110+16, 16, 100, 100);
@@ -629,6 +635,12 @@ void MainComponent::buttonClicked (Button* buttonThatWasClicked)
//[UserButtonCode_rbmTrainV2ToggleButton] -- add your button handler code here..
//[/UserButtonCode_rbmTrainV2ToggleButton]
}
else if (buttonThatWasClicked == rbmNormalizeDataToggleButton)
{
//[UserButtonCode_rbmNormalizeDataToggleButton] -- add your button handler code here..
m_pRbm->setNormalizeData(buttonThatWasClicked->getToggleState());
//[/UserButtonCode_rbmNormalizeDataToggleButton]
}
//[UserbuttonClicked_Post]
//[/UserbuttonClicked_Post]
@@ -645,7 +657,16 @@ void MainComponent::sliderValueChanged (Slider* sliderThatWasMoved)
if (m_layers.getSize() > 0)
{
VisibleLayer &p = (VisibleLayer&)m_layers.getAt((int)sliderThatWasMoved->getValue());
VectorXd t = p.states();
DrawTraining->setData(p.states());
cout << "mean = " << (double)p.states().array().mean() << endl;
cout << "max = " << (double)p.states().array().maxCoeff() << endl;
cout << "min = " << (double)p.states().array().minCoeff() << endl;
t.array() -= t.array().mean();
t.array() *= t.array();
cout << "var = " << (double)t.mean() << endl;
redrawReconstruction();
}
@@ -1067,6 +1088,9 @@ BEGIN_JUCER_METADATA
memberName="rbmTrainV2ToggleButton" virtualName="" explicitFocusOrder="0"
pos="336 200 128 24" buttonText="Train Ver. 2" connectedEdges="0"
needsCallback="1" radioGroupId="0" state="0"/>
<TOGGLEBUTTON name="rbmNormalizeData toggle button" id="739772af1b096120" memberName="rbmNormalizeDataToggleButton"
virtualName="" explicitFocusOrder="0" pos="336 232 160 24" buttonText="Normalize data"
connectedEdges="0" needsCallback="1" radioGroupId="0" state="0"/>
</JUCER_COMPONENT>
END_JUCER_METADATA