- cleaned up

git-svn-id: http://moon:8086/svn/software/trunk/projects/Rbm@625 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2019-11-07 16:35:00 +00:00
parent 4e21dd8114
commit 6ccffc119d
4 changed files with 13 additions and 105 deletions
+3 -2
View File
@@ -617,13 +617,14 @@ void MainComponent::sliderValueChanged (Slider* sliderThatWasMoved)
{
//[UserSliderCode_patterSlider] -- add your slider handling code here..
m_trainingIndex = (int)sliderThatWasMoved->getValue();
m_pLayer->setTrainingIndex(m_trainingData.row(m_trainingIndex));
m_pLayer->setTrainingData(m_trainingData.row(m_trainingIndex));
//[/UserSliderCode_patterSlider]
}
else if (sliderThatWasMoved == WeightsSlider)
{
//[UserSliderCode_WeightsSlider] -- add your slider handling code here..
m_weightIndex = (int)sliderThatWasMoved->getValue();
int weightIndex = (int)sliderThatWasMoved->getValue();
m_pLayer->redrawWeights(weightIndex);
//[/UserSliderCode_WeightsSlider]
}
else if (sliderThatWasMoved == numGibbsSlider)
+2 -25
View File
@@ -26,7 +26,6 @@
RbmComponent::RbmComponent (const std::string &name, size_t id, size_t numVisibleX, size_t numVisibleY, size_t numHidden, RbmComponentListener *pListener)
: Layer(name, id, numVisibleX, numVisibleY, numHidden)
, m_currWeightIndexToDraw(0)
, m_currTrainingIndexToDraw(0)
, DrawTraining(nullptr)
, DrawReconstruction(nullptr)
, DrawWeights(nullptr)
@@ -249,24 +248,12 @@ void RbmComponent::redrawWeights()
DrawWeights->DrawData();
}
void RbmComponent::onParamsChanged()
{
redrawWeights();
redrawReconstruction();
}
void RbmComponent::setWeightsIndex(size_t index)
void RbmComponent::redrawWeights(size_t index)
{
m_currWeightIndexToDraw = index;
redrawWeights();
}
size_t RbmComponent::getWeightsIndex()
{
return m_currWeightIndexToDraw;
}
void RbmComponent::setTrainingIndex(arma::mat const& batch)
void RbmComponent::setTrainingData(arma::mat const& batch)
{
DrawTraining->getData() = batch;
DrawTraining->DrawData();
@@ -275,16 +262,6 @@ void RbmComponent::setTrainingIndex(arma::mat const& batch)
upPass(DrawHidden->getData());
}
size_t RbmComponent::getTrainingIndex()
{
return m_currTrainingIndexToDraw;
}
arma::mat const& RbmComponent::getTrainingData()
{
return DrawTraining->getData();
}
arma::mat const& RbmComponent::getTopWeights()
{
if (upper)
+7 -11
View File
@@ -98,15 +98,17 @@ public:
void mouseDoubleClick (const MouseEvent& e) override;
void mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel) override;
void setWeightsIndex(size_t index);
size_t getWeightsIndex();
void train(const arma::mat& batch)
{
Layer::train(batch, this);
}
void setTrainingIndex(arma::mat const& batch);
size_t getTrainingIndex();
void setTrainingData(arma::mat const& batch);
void redrawWeights();
void redrawWeights(size_t index);
void redrawReconstruction();
arma::mat const& getTrainingData();
void downPass(arma::mat &dst, arma::mat const &src) override
{
@@ -133,10 +135,6 @@ public:
arma::mat getConvolutedWeight(arma::mat const &h) override;
arma::mat const& getWeights() override;
void train(const arma::mat& batch)
{
Layer::train(batch, this);
}
private:
//[UserVariables] -- You can add your own custom variables in this section.
RbmComponentListener *m_listener;
@@ -145,8 +143,6 @@ private:
ScopedPointer<DrawComponent> DrawWeights;
ScopedPointer<DrawComponent> DrawHidden;
size_t m_currWeightIndexToDraw;
size_t m_currTrainingIndexToDraw;
void onParamsChanged();
bool onProgress(const Rbm::Status &status) override;
void onDraw(DrawComponent &obj) override;
//[/UserVariables]