diff --git a/Source/Layer.hpp b/Source/Layer.hpp index c016eff..7a68185 100644 --- a/Source/Layer.hpp +++ b/Source/Layer.hpp @@ -26,8 +26,8 @@ public: , m_probs(numUnits) , m_states(numUnits) { - setNumUnits(numUnits); Noise_Init(&m_noise, 0x12345677); + setNumUnits(numUnits); if (pStatesInit && (pStatesInit->size() == numUnits)) { diff --git a/Source/MainComponent.cpp b/Source/MainComponent.cpp index a64fd08..7f3fea1 100644 --- a/Source/MainComponent.cpp +++ b/Source/MainComponent.cpp @@ -271,6 +271,15 @@ MainComponent::MainComponent () sparsityLearningRateLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); sparsityLearningRateLabel->addListener (this); + addAndMakeVisible (weightInitLabel = new Label ("WeightInit label", + TRANS("0.001"))); + weightInitLabel->setFont (Font (15.00f, Font::plain)); + weightInitLabel->setJustificationType (Justification::centred); + weightInitLabel->setEditable (true, true, false); + weightInitLabel->setColour (TextEditor::textColourId, Colours::black); + weightInitLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000)); + weightInitLabel->addListener (this); + //[UserPreSize] m_vNumX = 16; @@ -329,6 +338,7 @@ MainComponent::~MainComponent() m_progressBarSlider = nullptr; momentumLabel = nullptr; sparsityLearningRateLabel = nullptr; + weightInitLabel = nullptr; //[Destructor]. You can add your own custom destruction code here.. @@ -403,6 +413,12 @@ void MainComponent::paint (Graphics& g) 408, 306, 96, 14, Justification::centred, true); + g.setColour (Colours::black); + g.setFont (Font (15.00f, Font::plain)); + g.drawText (TRANS("Weight init"), + 408, 354, 96, 14, + Justification::centred, true); + //[UserPaint] Add your own custom painting code here.. //[/UserPaint] } @@ -443,6 +459,7 @@ void MainComponent::resized() m_progressBarSlider->setBounds (216, 160, 184, 24); momentumLabel->setBounds (208, 368, 72, 24); sparsityLearningRateLabel->setBounds (416, 320, 72, 24); + weightInitLabel->setBounds (416, 368, 72, 24); //[UserResized] Add your own custom resize handling here.. DrawTraining->setBounds (16, 16, 100, 100); DrawReconstruction->setBounds (110+16, 16, 100, 100); @@ -482,7 +499,7 @@ void MainComponent::buttonClicked (Button* buttonThatWasClicked) else if (buttonThatWasClicked == ShakeButton) { //[UserButtonCode_ShakeButton] -- add your button handler code here.. - m_weights.shuffle(0.001); + m_weights.shuffle(weightInitLabel->getText().getFloatValue()); redrawReconstruction(); redrawWeights((int)WeightsSlider->getValue()); //[/UserButtonCode_ShakeButton] @@ -726,6 +743,11 @@ void MainComponent::labelTextChanged (Label* labelThatHasChanged) m_pRbm->setMuSparsity(labelThatHasChanged->getText().getFloatValue()); //[/UserLabelCode_sparsityLearningRateLabel] } + else if (labelThatHasChanged == weightInitLabel) + { + //[UserLabelCode_weightInitLabel] -- add your label text handling code here.. + //[/UserLabelCode_weightInitLabel] + } //[UserlabelTextChanged_Post] //[/UserlabelTextChanged_Post] @@ -770,7 +792,7 @@ void MainComponent::create() m_pRbm = new Rbm(m_weights, this); sigma_gauss = 0.5; - sigmaDecay_gauss = 0.99; + sigmaDecay_gauss = 1.0; m_pRbm->setDoRaoBlackwell(rbmDoRaoBlackwellToggleButton->getToggleState()); m_pRbm->setUseProbsForHiddenReconstruction(rbmReduceVarianceToggleButton->getToggleState()); m_pRbm->setUseVisibleGaussian(rbmUseVisibleGaussianToggleButton->getToggleState()); @@ -898,6 +920,8 @@ BEGIN_JUCER_METADATA fontname="Default font" fontsize="15" bold="0" italic="0" justification="36"/> + +