[RBM]
- MainComponent:fixed Jucer contention - RBM : clear before file load git-svn-id: http://moon:8086/svn/software/trunk/projects/RBM@289 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
+23
-24
@@ -39,7 +39,6 @@ void mylog(const char* format, ...)
|
|||||||
MainComponent::MainComponent ()
|
MainComponent::MainComponent ()
|
||||||
: Thread("RBM"),
|
: Thread("RBM"),
|
||||||
m_pRbmComponent(nullptr)
|
m_pRbmComponent(nullptr)
|
||||||
|
|
||||||
{
|
{
|
||||||
addAndMakeVisible (trainButton = new TextButton ("Train button"));
|
addAndMakeVisible (trainButton = new TextButton ("Train button"));
|
||||||
trainButton->setButtonText (TRANS("Train"));
|
trainButton->setButtonText (TRANS("Train"));
|
||||||
@@ -353,7 +352,7 @@ void MainComponent::paint (Graphics& g)
|
|||||||
g.setColour (Colours::black);
|
g.setColour (Colours::black);
|
||||||
g.setFont (Font (15.00f, Font::plain));
|
g.setFont (Font (15.00f, Font::plain));
|
||||||
g.drawText (TRANS("Num. epochs"),
|
g.drawText (TRANS("Num. epochs"),
|
||||||
32, 354, 80, 14,
|
23, 354, 91, 14,
|
||||||
Justification::centred, true);
|
Justification::centred, true);
|
||||||
|
|
||||||
g.setColour (Colours::black);
|
g.setColour (Colours::black);
|
||||||
@@ -445,16 +444,6 @@ void MainComponent::resized()
|
|||||||
//[/UserResized]
|
//[/UserResized]
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainComponent::onLayerSizeChanged(size_t size)
|
|
||||||
{
|
|
||||||
patterSlider->setRange(0, size-1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainComponent::onRbmEpochTrained(size_t progressPercent)
|
|
||||||
{
|
|
||||||
m_progressBarSlider->setValue(progressPercent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainComponent::buttonClicked (Button* buttonThatWasClicked)
|
void MainComponent::buttonClicked (Button* buttonThatWasClicked)
|
||||||
{
|
{
|
||||||
//[UserbuttonClicked_Pre]
|
//[UserbuttonClicked_Pre]
|
||||||
@@ -514,7 +503,6 @@ void MainComponent::buttonClicked (Button* buttonThatWasClicked)
|
|||||||
else if (buttonThatWasClicked == loadTrainingButton)
|
else if (buttonThatWasClicked == loadTrainingButton)
|
||||||
{
|
{
|
||||||
//[UserButtonCode_loadTrainingButton] -- add your button handler code here..
|
//[UserButtonCode_loadTrainingButton] -- add your button handler code here..
|
||||||
m_pRbmComponent->clearTraining();
|
|
||||||
m_pRbmComponent->loadTraining((String(getBaseDir() + String(".trainingStates.dat"))).toUTF8());
|
m_pRbmComponent->loadTraining((String(getBaseDir() + String(".trainingStates.dat"))).toUTF8());
|
||||||
//[/UserButtonCode_loadTrainingButton]
|
//[/UserButtonCode_loadTrainingButton]
|
||||||
}
|
}
|
||||||
@@ -797,7 +785,7 @@ void MainComponent::create(const char *pFilename)
|
|||||||
|
|
||||||
addAndMakeVisible(m_pRbmComponent = new RbmComponent(*m_weights, *this));
|
addAndMakeVisible(m_pRbmComponent = new RbmComponent(*m_weights, *this));
|
||||||
m_pRbmComponent->setBounds (16, 16, 430, 130);
|
m_pRbmComponent->setBounds (16, 16, 430, 130);
|
||||||
|
|
||||||
m_pRbmComponent->setDoRaoBlackwell(rbmDoRaoBlackwellToggleButton->getToggleState());
|
m_pRbmComponent->setDoRaoBlackwell(rbmDoRaoBlackwellToggleButton->getToggleState());
|
||||||
m_pRbmComponent->setUseProbsForHiddenReconstruction(rbmReduceVarianceToggleButton->getToggleState());
|
m_pRbmComponent->setUseProbsForHiddenReconstruction(rbmReduceVarianceToggleButton->getToggleState());
|
||||||
m_pRbmComponent->setUseVisibleGaussian(rbmUseVisibleGaussianToggleButton->getToggleState());
|
m_pRbmComponent->setUseVisibleGaussian(rbmUseVisibleGaussianToggleButton->getToggleState());
|
||||||
@@ -815,7 +803,8 @@ void MainComponent::create(const char *pFilename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
resized();
|
resized();
|
||||||
|
|
||||||
|
m_pRbmComponent->loadTraining((String(getBaseDir() + String(".trainingStates.dat"))).toUTF8());
|
||||||
m_pRbmComponent->redrawReconstruction();
|
m_pRbmComponent->redrawReconstruction();
|
||||||
m_pRbmComponent->selectWeights((int)WeightsSlider->getValue());
|
m_pRbmComponent->selectWeights((int)WeightsSlider->getValue());
|
||||||
}
|
}
|
||||||
@@ -839,6 +828,16 @@ void MainComponent::run()
|
|||||||
// trainButton->setEnabled(true);
|
// trainButton->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainComponent::onLayerSizeChanged(size_t size)
|
||||||
|
{
|
||||||
|
patterSlider->setRange(0, size-1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainComponent::onRbmEpochTrained(size_t progressPercent)
|
||||||
|
{
|
||||||
|
m_progressBarSlider->setValue(progressPercent);
|
||||||
|
}
|
||||||
|
|
||||||
//[/MiscUserCode]
|
//[/MiscUserCode]
|
||||||
|
|
||||||
|
|
||||||
@@ -852,9 +851,9 @@ void MainComponent::run()
|
|||||||
BEGIN_JUCER_METADATA
|
BEGIN_JUCER_METADATA
|
||||||
|
|
||||||
<JUCER_COMPONENT documentType="Component" className="MainComponent" componentName=""
|
<JUCER_COMPONENT documentType="Component" className="MainComponent" componentName=""
|
||||||
parentClasses="public Component, public LayerArrayListener, public RbmListener, public DrawListener, public Thread"
|
parentClasses="public Component, public RbmComponentListener, public Thread"
|
||||||
constructorParams="" variableInitialisers="Thread("RBM"), m_layers(this), m_pRbm(nullptr) DrawTraining(nullptr), DrawReconstruction(nullptr), DrawWeights(nullptr), DrawHidden(nullptr)"
|
constructorParams="" variableInitialisers="Thread("RBM"), m_pRbmComponent(nullptr)"
|
||||||
snapPixels="8" snapActive="1" snapShown="1" overlayOpacity="0.330"
|
snapPixels="4" snapActive="1" snapShown="1" overlayOpacity="0.330"
|
||||||
fixedSize="1" initialWidth="800" initialHeight="600">
|
fixedSize="1" initialWidth="800" initialHeight="600">
|
||||||
<METHODS>
|
<METHODS>
|
||||||
<METHOD name="mouseMove (const MouseEvent& e)"/>
|
<METHOD name="mouseMove (const MouseEvent& e)"/>
|
||||||
@@ -871,7 +870,7 @@ BEGIN_JUCER_METADATA
|
|||||||
fontname="Default font" fontsize="15" bold="0" italic="0" justification="36"/>
|
fontname="Default font" fontsize="15" bold="0" italic="0" justification="36"/>
|
||||||
<TEXT pos="120 306 80 14" fill="solid: ff000000" hasStroke="0" text="Lambda"
|
<TEXT pos="120 306 80 14" fill="solid: ff000000" hasStroke="0" text="Lambda"
|
||||||
fontname="Default font" fontsize="15" bold="0" italic="0" justification="36"/>
|
fontname="Default font" fontsize="15" bold="0" italic="0" justification="36"/>
|
||||||
<TEXT pos="32 354 80 14" fill="solid: ff000000" hasStroke="0" text="Num. epochs"
|
<TEXT pos="23 354 91 14" fill="solid: ff000000" hasStroke="0" text="Num. epochs"
|
||||||
fontname="Default font" fontsize="15" bold="0" italic="0" justification="36"/>
|
fontname="Default font" fontsize="15" bold="0" italic="0" justification="36"/>
|
||||||
<TEXT pos="120 354 80 14" fill="solid: ff000000" hasStroke="0" text="Alpha"
|
<TEXT pos="120 354 80 14" fill="solid: ff000000" hasStroke="0" text="Alpha"
|
||||||
fontname="Default font" fontsize="15" bold="0" italic="0" justification="36"/>
|
fontname="Default font" fontsize="15" bold="0" italic="0" justification="36"/>
|
||||||
@@ -910,7 +909,7 @@ BEGIN_JUCER_METADATA
|
|||||||
textBoxWidth="80" textBoxHeight="20" skewFactor="1"/>
|
textBoxWidth="80" textBoxHeight="20" skewFactor="1"/>
|
||||||
<LABEL name="Num Epochs label" id="b23ae372ee931474" memberName="numEpochslabel"
|
<LABEL name="Num Epochs label" id="b23ae372ee931474" memberName="numEpochslabel"
|
||||||
virtualName="" explicitFocusOrder="0" pos="32 368 72 24" edTextCol="ff000000"
|
virtualName="" explicitFocusOrder="0" pos="32 368 72 24" edTextCol="ff000000"
|
||||||
edBkgCol="0" labelText="100" editableSingleClick="1" editableDoubleClick="1"
|
edBkgCol="0" labelText="1000" editableSingleClick="1" editableDoubleClick="1"
|
||||||
focusDiscardsChanges="0" fontname="Default font" fontsize="15"
|
focusDiscardsChanges="0" fontname="Default font" fontsize="15"
|
||||||
bold="0" italic="0" justification="36"/>
|
bold="0" italic="0" justification="36"/>
|
||||||
<LABEL name="Learning Rate label" id="49611a27914e910d" memberName="learningRateLabel"
|
<LABEL name="Learning Rate label" id="49611a27914e910d" memberName="learningRateLabel"
|
||||||
@@ -923,12 +922,12 @@ BEGIN_JUCER_METADATA
|
|||||||
connectedEdges="0" needsCallback="1" radioGroupId="0"/>
|
connectedEdges="0" needsCallback="1" radioGroupId="0"/>
|
||||||
<LABEL name="Num Visible label" id="60acd702770b77dd" memberName="numVisibleLabel"
|
<LABEL name="Num Visible label" id="60acd702770b77dd" memberName="numVisibleLabel"
|
||||||
virtualName="" explicitFocusOrder="0" pos="504 224 72 24" edTextCol="ff000000"
|
virtualName="" explicitFocusOrder="0" pos="504 224 72 24" edTextCol="ff000000"
|
||||||
edBkgCol="0" labelText="99999" editableSingleClick="1" editableDoubleClick="1"
|
edBkgCol="0" labelText="16" editableSingleClick="1" editableDoubleClick="1"
|
||||||
focusDiscardsChanges="0" fontname="Default font" fontsize="15"
|
focusDiscardsChanges="0" fontname="Default font" fontsize="15"
|
||||||
bold="0" italic="0" justification="36"/>
|
bold="0" italic="0" justification="36"/>
|
||||||
<LABEL name="Num Hidden label" id="8a56c0419bd3ce86" memberName="numHiddenLabel"
|
<LABEL name="Num Hidden label" id="8a56c0419bd3ce86" memberName="numHiddenLabel"
|
||||||
virtualName="" explicitFocusOrder="0" pos="552 256 72 24" edTextCol="ff000000"
|
virtualName="" explicitFocusOrder="0" pos="552 256 72 24" edTextCol="ff000000"
|
||||||
edBkgCol="0" labelText="99999" editableSingleClick="1" editableDoubleClick="1"
|
edBkgCol="0" labelText="64" editableSingleClick="1" editableDoubleClick="1"
|
||||||
focusDiscardsChanges="0" fontname="Default font" fontsize="15"
|
focusDiscardsChanges="0" fontname="Default font" fontsize="15"
|
||||||
bold="0" italic="0" justification="36"/>
|
bold="0" italic="0" justification="36"/>
|
||||||
<TEXTBUTTON name="Create button" id="6c71593a581844eb" memberName="createButton"
|
<TEXTBUTTON name="Create button" id="6c71593a581844eb" memberName="createButton"
|
||||||
@@ -936,7 +935,7 @@ BEGIN_JUCER_METADATA
|
|||||||
connectedEdges="0" needsCallback="1" radioGroupId="0"/>
|
connectedEdges="0" needsCallback="1" radioGroupId="0"/>
|
||||||
<LABEL name="Project Name label" id="b4e855167abdac6b" memberName="projectNameLabel"
|
<LABEL name="Project Name label" id="b4e855167abdac6b" memberName="projectNameLabel"
|
||||||
virtualName="" explicitFocusOrder="0" pos="536 192 96 24" edTextCol="ff000000"
|
virtualName="" explicitFocusOrder="0" pos="536 192 96 24" edTextCol="ff000000"
|
||||||
edBkgCol="0" labelText="TestPrj" editableSingleClick="1" editableDoubleClick="1"
|
edBkgCol="0" labelText="test" editableSingleClick="1" editableDoubleClick="1"
|
||||||
focusDiscardsChanges="0" fontname="Default font" fontsize="15"
|
focusDiscardsChanges="0" fontname="Default font" fontsize="15"
|
||||||
bold="0" italic="0" justification="36"/>
|
bold="0" italic="0" justification="36"/>
|
||||||
<TEXTBUTTON name="Load button" id="4e606c77b12e7d11" memberName="loadButton"
|
<TEXTBUTTON name="Load button" id="4e606c77b12e7d11" memberName="loadButton"
|
||||||
@@ -947,7 +946,7 @@ BEGIN_JUCER_METADATA
|
|||||||
connectedEdges="0" needsCallback="1" radioGroupId="0"/>
|
connectedEdges="0" needsCallback="1" radioGroupId="0"/>
|
||||||
<LABEL name="Num Visible Y label" id="101a4f77ca2445ba" memberName="numVisibleYLabel"
|
<LABEL name="Num Visible Y label" id="101a4f77ca2445ba" memberName="numVisibleYLabel"
|
||||||
virtualName="" explicitFocusOrder="0" pos="576 224 72 24" edTextCol="ff000000"
|
virtualName="" explicitFocusOrder="0" pos="576 224 72 24" edTextCol="ff000000"
|
||||||
edBkgCol="0" labelText="99999" editableSingleClick="1" editableDoubleClick="1"
|
edBkgCol="0" labelText="16" editableSingleClick="1" editableDoubleClick="1"
|
||||||
focusDiscardsChanges="0" fontname="Default font" fontsize="15"
|
focusDiscardsChanges="0" fontname="Default font" fontsize="15"
|
||||||
bold="0" italic="0" justification="36"/>
|
bold="0" italic="0" justification="36"/>
|
||||||
<TEXTBUTTON name="Load Training button" id="c603a32c128de05d" memberName="loadTrainingButton"
|
<TEXTBUTTON name="Load Training button" id="c603a32c128de05d" memberName="loadTrainingButton"
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ public:
|
|||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
//[UserMethods] -- You can add your own custom methods in this section.
|
//[UserMethods] -- You can add your own custom methods in this section.
|
||||||
|
void onLayerSizeChanged(size_t size) override;
|
||||||
|
void onRbmEpochTrained(size_t progressPercent) override;
|
||||||
//[/UserMethods]
|
//[/UserMethods]
|
||||||
|
|
||||||
void paint (Graphics& g);
|
void paint (Graphics& g);
|
||||||
@@ -67,9 +69,6 @@ public:
|
|||||||
void mouseDoubleClick (const MouseEvent& e);
|
void mouseDoubleClick (const MouseEvent& e);
|
||||||
void mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel);
|
void mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel);
|
||||||
|
|
||||||
void onLayerSizeChanged(size_t size) override;
|
|
||||||
void onRbmEpochTrained(size_t progressPercent) override;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ public:
|
|||||||
|
|
||||||
void loadTraining(const char *pFilename)
|
void loadTraining(const char *pFilename)
|
||||||
{
|
{
|
||||||
|
m_layers.clear();
|
||||||
m_layers.load(pFilename);
|
m_layers.load(pFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user