- 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:
+1
-14
@@ -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)
|
: Layer(name, id, numVisibleX, numVisibleY, numHidden)
|
||||||
, m_currWeightIndexToDraw(0)
|
, m_currWeightIndexToDraw(0)
|
||||||
, DrawTraining(nullptr)
|
, DrawTraining(nullptr)
|
||||||
, DrawReconstruction(nullptr)
|
, DrawReconstruction(nullptr)
|
||||||
, DrawWeights(nullptr)
|
, DrawWeights(nullptr)
|
||||||
, DrawHidden(nullptr)
|
, DrawHidden(nullptr)
|
||||||
, m_listener(pListener)
|
|
||||||
{
|
{
|
||||||
addAndMakeVisible (DrawTraining = new DrawComponent (numVisibleX, numVisibleY));
|
addAndMakeVisible (DrawTraining = new DrawComponent (numVisibleX, numVisibleY));
|
||||||
DrawTraining->setListener(this);
|
DrawTraining->setListener(this);
|
||||||
@@ -192,18 +191,6 @@ void RbmComponent::mouseWheelMove (const MouseEvent& e, const MouseWheelDetails&
|
|||||||
//[/UserCode_mouseWheelMove]
|
//[/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)
|
void RbmComponent::onDraw(DrawComponent &obj)
|
||||||
{
|
{
|
||||||
if (&obj == DrawHidden)
|
if (&obj == DrawHidden)
|
||||||
|
|||||||
+2
-21
@@ -53,17 +53,6 @@ public:
|
|||||||
virtual arma::mat const& getWeights() = 0;
|
virtual arma::mat const& getWeights() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RbmComponentListener
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RbmComponentListener() {}
|
|
||||||
virtual ~RbmComponentListener()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
virtual bool onProgressChanged(size_t progressPercent) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
/**
|
/**
|
||||||
//[Comments]
|
//[Comments]
|
||||||
@@ -76,11 +65,10 @@ class RbmComponent : public Component
|
|||||||
, public Layer
|
, public Layer
|
||||||
, public DrawListener
|
, public DrawListener
|
||||||
, public IRbmComponent
|
, public IRbmComponent
|
||||||
, public Rbm::IListener
|
|
||||||
{
|
{
|
||||||
public:
|
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();
|
~RbmComponent();
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
@@ -98,11 +86,6 @@ public:
|
|||||||
void mouseDoubleClick (const MouseEvent& e) override;
|
void mouseDoubleClick (const MouseEvent& e) override;
|
||||||
void mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel) 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 setTrainingData(arma::mat const& batch);
|
||||||
|
|
||||||
void redrawWeights();
|
void redrawWeights();
|
||||||
@@ -135,15 +118,13 @@ public:
|
|||||||
arma::mat getConvolutedWeight(arma::mat const &h) override;
|
arma::mat getConvolutedWeight(arma::mat const &h) override;
|
||||||
arma::mat const& getWeights() override;
|
arma::mat const& getWeights() override;
|
||||||
ScopedPointer<DrawComponent> DrawTraining;
|
ScopedPointer<DrawComponent> DrawTraining;
|
||||||
|
ScopedPointer<DrawComponent> DrawHidden;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//[UserVariables] -- You can add your own custom variables in this section.
|
//[UserVariables] -- You can add your own custom variables in this section.
|
||||||
RbmComponentListener *m_listener;
|
|
||||||
ScopedPointer<DrawComponent> DrawReconstruction;
|
ScopedPointer<DrawComponent> DrawReconstruction;
|
||||||
ScopedPointer<DrawComponent> DrawWeights;
|
ScopedPointer<DrawComponent> DrawWeights;
|
||||||
ScopedPointer<DrawComponent> DrawHidden;
|
|
||||||
size_t m_currWeightIndexToDraw;
|
size_t m_currWeightIndexToDraw;
|
||||||
bool onProgress(const Rbm::Status &status) override;
|
|
||||||
void onDraw(DrawComponent &obj) override;
|
void onDraw(DrawComponent &obj) override;
|
||||||
//[/UserVariables]
|
//[/UserVariables]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user