Made mlp::net::operator() a virtual function to allow for subclassing
with networks that transform their input or output.
This commit is contained in:
parent
250d31f904
commit
3943287ad0
1 changed files with 14 additions and 9 deletions
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
#include <values.h> // MAXFLOAT MINFLOAT
|
#include <values.h> // MAXFLOAT MINFLOAT
|
||||||
#include <math.h> // exp
|
#include <math.h> // exp
|
||||||
#include <stdexcept> // invalid_argument
|
#include <stdexcept> // invalid_argument
|
||||||
|
|
@ -258,15 +259,7 @@ namespace mlp {
|
||||||
l->reset();
|
l->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
vector operator()(const vector& input) const
|
virtual vector operator()(const vector& input) const ;
|
||||||
{
|
|
||||||
vector tmp = input;
|
|
||||||
|
|
||||||
for(const_iterator l = begin(); l != end(); ++l)
|
|
||||||
tmp = (*l)(tmp);
|
|
||||||
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned winner(const vector& input) const
|
unsigned winner(const vector& input) const
|
||||||
{
|
{
|
||||||
|
|
@ -315,6 +308,18 @@ namespace mlp {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef NO_MLP_VIRTUALS
|
||||||
|
vector net::operator()(const vector& input) const
|
||||||
|
{
|
||||||
|
vector tmp = input;
|
||||||
|
|
||||||
|
for(const_iterator l = begin(); l != end(); ++l)
|
||||||
|
tmp = (*l)(tmp);
|
||||||
|
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// sample
|
// sample
|
||||||
|
|
|
||||||
Reference in a new issue