[RBM]
- DrawComponent: use fixed value scaling - Rbm: fixed weight decay - Rbm: fixed sparsity git-svn-id: http://moon:8086/svn/software/trunk/projects/RBM@298 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
+12
-27
@@ -29,13 +29,15 @@ void mylog(const char* format, ...);
|
||||
//[/MiscUserDefs]
|
||||
|
||||
//==============================================================================
|
||||
DrawComponent::DrawComponent (int width, int height)
|
||||
DrawComponent::DrawComponent (int width, int height, float offset, float scale)
|
||||
: m_pListener(nullptr)
|
||||
{
|
||||
|
||||
//[UserPreSize]
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
m_offset = offset;
|
||||
m_scale = scale;
|
||||
m_scaleX = 1.0;
|
||||
m_scaleY = 1.0;
|
||||
m_pG = nullptr;
|
||||
@@ -231,39 +233,22 @@ RowVectorXd& DrawComponent::getData ()
|
||||
void DrawComponent::DrawData ()
|
||||
{
|
||||
|
||||
double a;
|
||||
RowVectorXd temp = m_data;
|
||||
double min = +1E12;
|
||||
double max = -1E12;
|
||||
|
||||
for (int i=0; i < m_width*m_height; i++)
|
||||
{
|
||||
min = std::min<double>(min, (double)temp[i]);
|
||||
max = std::max<double>(max, (double)temp[i]);
|
||||
}
|
||||
|
||||
if (min < 0)
|
||||
{
|
||||
for (int i=0; i < m_width*m_height; i++)
|
||||
{
|
||||
temp[i] -= min;
|
||||
}
|
||||
max -= min;
|
||||
}
|
||||
for (int i=0; i < m_width*m_height; i++)
|
||||
{
|
||||
temp[i] /= max;
|
||||
temp[i] = std::min<double>(1.0, (double)temp[i]);
|
||||
temp[i] = std::max<double>(-1.0, (double)temp[i]);
|
||||
}
|
||||
|
||||
for (int i=0; i < m_height; i++)
|
||||
{
|
||||
for (int j=0; j < m_width; j++)
|
||||
{
|
||||
a = std::min<double>(std::max<double>((double)temp[i*m_width + j], 0), 1);
|
||||
m_pG->setColour(Colour(Colours::white).greyLevel(a));
|
||||
m_pG->fillRect(m_scaleX*j, m_scaleY*i, m_scaleX, m_scaleY);
|
||||
}
|
||||
}
|
||||
{
|
||||
for (int j=0; j < m_width; j++)
|
||||
{
|
||||
m_pG->setColour(Colour(Colours::white).greyLevel(m_offset + m_scale*temp[i*m_width + j]));
|
||||
m_pG->fillRect(m_scaleX*j, m_scaleY*i, m_scaleX, m_scaleY);
|
||||
}
|
||||
}
|
||||
repaint();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user