- no RbmComponentListener anymore

git-svn-id: http://moon:8086/svn/software/trunk/projects/Rbm@634 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2019-11-07 19:26:14 +00:00
parent 732f6b67f6
commit 8605b37b30
2 changed files with 3 additions and 35 deletions
+1 -14
View File
@@ -23,14 +23,13 @@
//==============================================================================
RbmComponent::RbmComponent (const std::string &name, size_t id, size_t numVisibleX, size_t numVisibleY, size_t numHidden, RbmComponentListener *pListener)
RbmComponent::RbmComponent (const std::string &name, size_t id, size_t numVisibleX, size_t numVisibleY, size_t numHidden)
: Layer(name, id, numVisibleX, numVisibleY, numHidden)
, m_currWeightIndexToDraw(0)
, DrawTraining(nullptr)
, DrawReconstruction(nullptr)
, DrawWeights(nullptr)
, DrawHidden(nullptr)
, m_listener(pListener)
{
addAndMakeVisible (DrawTraining = new DrawComponent (numVisibleX, numVisibleY));
DrawTraining->setListener(this);
@@ -192,18 +191,6 @@ void RbmComponent::mouseWheelMove (const MouseEvent& e, const MouseWheelDetails&
//[/UserCode_mouseWheelMove]
}
bool RbmComponent::onProgress(const Rbm::Status &status)
{
upPass(DrawHidden->getData());
redrawReconstruction();
redrawWeights();
if (m_listener)
{
return m_listener->onProgressChanged((size_t)(100*status.progress + 0.5));
}
return true;
}
void RbmComponent::onDraw(DrawComponent &obj)
{
if (&obj == DrawHidden)
+2 -21
View File
@@ -53,17 +53,6 @@ public:
virtual arma::mat const& getWeights() = 0;
};
class RbmComponentListener
{
public:
RbmComponentListener() {}
virtual ~RbmComponentListener()
{
}
virtual bool onProgressChanged(size_t progressPercent) = 0;
};
//==============================================================================
/**
//[Comments]
@@ -76,11 +65,10 @@ class RbmComponent : public Component
, public Layer
, public DrawListener
, public IRbmComponent
, public Rbm::IListener
{
public:
//==============================================================================
RbmComponent (const std::string &name, size_t id, size_t numVisibleX, size_t numVisibleY, size_t numHidden, RbmComponentListener *pListener=nullptr);
RbmComponent (const std::string &name, size_t id, size_t numVisibleX, size_t numVisibleY, size_t numHidden);
~RbmComponent();
//==============================================================================
@@ -98,11 +86,6 @@ public:
void mouseDoubleClick (const MouseEvent& e) override;
void mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel) override;
void train(const arma::mat& batch)
{
Layer::train(batch, this);
}
void setTrainingData(arma::mat const& batch);
void redrawWeights();
@@ -135,15 +118,13 @@ public:
arma::mat getConvolutedWeight(arma::mat const &h) override;
arma::mat const& getWeights() override;
ScopedPointer<DrawComponent> DrawTraining;
ScopedPointer<DrawComponent> DrawHidden;
private:
//[UserVariables] -- You can add your own custom variables in this section.
RbmComponentListener *m_listener;
ScopedPointer<DrawComponent> DrawReconstruction;
ScopedPointer<DrawComponent> DrawWeights;
ScopedPointer<DrawComponent> DrawHidden;
size_t m_currWeightIndexToDraw;
bool onProgress(const Rbm::Status &status) override;
void onDraw(DrawComponent &obj) override;
//[/UserVariables]