* New tree configuration of the project:
.../
... + -- EO
| |
| |
+-- src ----- + -- EDO
| |
| |
+-- test + -- MO
| |
| |
+-- tutorial + -- MOEO
| |
| |
+-- doc + -- SMP
| |
| |
... + -- EOMPI
|
|
+ -- EOSERIAL
Question for current maintainers: ./README: new release?
Also:
* Moving out eompi & eoserial modules (issue #2).
* Correction of the errors when executing "make doc" command.
* Adding a solution for the conflicting headers problem (see the two CMake Cache
Values: PROJECT_TAG & PROJECT_HRS_INSTALL_SUBPATH) (issue #1)
* Header inclusions:
** src: changing absolute paths into relative paths ('#include <...>' -> '#include "..."')
** test, tutorial: changing relative paths into absolute paths ('#include "..."' -> '#include <...>')
* Moving out some scripts from EDO -> to the root
* Add a new script for compilation and installation (see build_gcc_linux_install)
* Compilation with uBLAS library or EDO module: now ok
* Minor modifications on README & INSTALL files
* Comment eompi failed tests with no end
*** TODO: CPack (debian (DEB) & RedHat (RPM) packages) (issues #6 & #7) ***
This commit is contained in:
parent
515bd5943d
commit
490e837f7a
2359 changed files with 7688 additions and 16329 deletions
|
|
@ -1,140 +0,0 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// mse.h
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef mse_h
|
||||
#define mse_h
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <qp.h> // neuron layer net set
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace mse
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
// useful typedefs
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
using qp::real;
|
||||
using qp::vector;
|
||||
using qp::max_real;
|
||||
using qp::min_real;
|
||||
using qp::set;
|
||||
using qp::neuron;
|
||||
using qp::layer;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// error
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
real error(const mlp::net& net, const set& ts)
|
||||
{
|
||||
real error_ = 0.0;
|
||||
|
||||
for (set::const_iterator s = ts.begin(); s != ts.end(); ++s)
|
||||
{
|
||||
vector out = net(s->input);
|
||||
|
||||
for (unsigned i = 0; i < out.size(); ++i)
|
||||
{
|
||||
real diff = s->output[i] - out[i];
|
||||
error_ += diff * diff;
|
||||
}
|
||||
}
|
||||
|
||||
return error_ / ts.size();
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
// mse
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
class net: public qp::net
|
||||
{
|
||||
public:
|
||||
net(mlp::net& n): qp::net(n) {}
|
||||
|
||||
real error(const set& ts)
|
||||
{
|
||||
real error_ = 0;
|
||||
|
||||
for (set::const_iterator s = ts.begin(); s != ts.end(); ++s)
|
||||
{
|
||||
forward(s->input);
|
||||
error_ += backward(s->input, s->output);
|
||||
}
|
||||
error_ /= ts.size();
|
||||
|
||||
return error_;
|
||||
}
|
||||
|
||||
private:
|
||||
real backward(const vector& input, const vector& output)
|
||||
{
|
||||
reverse_iterator current_layer = rbegin();
|
||||
reverse_iterator backward_layer = current_layer + 1;
|
||||
real error_ = 0;
|
||||
|
||||
// output layer
|
||||
for (unsigned j = 0; j < current_layer->size(); ++j)
|
||||
{
|
||||
neuron& n = (*current_layer)[j];
|
||||
|
||||
real diff = output[j] - n.out;
|
||||
n.ndelta += n.delta = diff * n.out * (1.0 - n.out);
|
||||
|
||||
if (size() == 1) // monolayer
|
||||
n.dxo += n.delta * input;
|
||||
else // multilayer
|
||||
for (unsigned k = 0; k < n.dxo.size(); ++k)
|
||||
n.dxo[k] += n.delta * (*backward_layer)[k].out;
|
||||
|
||||
error_ += diff * diff;
|
||||
}
|
||||
|
||||
// hidden layers
|
||||
while (++current_layer != rend())
|
||||
{
|
||||
reverse_iterator forward_layer = current_layer - 1;
|
||||
reverse_iterator backward_layer = current_layer + 1;
|
||||
|
||||
for (unsigned j = 0; j < current_layer->size(); ++j)
|
||||
{
|
||||
|
||||
neuron& n = (*current_layer)[j];
|
||||
real sum = 0;
|
||||
|
||||
for (unsigned k = 0; k < forward_layer->size(); ++k)
|
||||
{
|
||||
neuron& nf = (*forward_layer)[k];
|
||||
sum += nf.delta * (nf.n->weight[j] + nf.dweight1[j]);
|
||||
}
|
||||
|
||||
n.delta = n.out * (1.0 - n.out) * sum;
|
||||
n.ndelta += n.delta;
|
||||
|
||||
|
||||
if (backward_layer == rend()) // first hidden layer
|
||||
n.dxo += n.delta * input;
|
||||
else // rest of hidden layers
|
||||
for (unsigned k = 0; k < n.dxo.size(); ++k)
|
||||
n.dxo[k] += n.delta * (*backward_layer)[k].out;
|
||||
}
|
||||
}
|
||||
|
||||
return error_;
|
||||
}
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
} // namespace mse
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif // mse_h
|
||||
|
||||
// Local Variables:
|
||||
// mode:C++
|
||||
// End:
|
||||
Loading…
Add table
Add a link
Reference in a new issue