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 <math.h> // exp
|
||||
#include <stdexcept> // invalid_argument
|
||||
|
|
@ -258,15 +259,7 @@ namespace mlp {
|
|||
l->reset();
|
||||
}
|
||||
|
||||
vector operator()(const vector& input) const
|
||||
{
|
||||
vector tmp = input;
|
||||
|
||||
for(const_iterator l = begin(); l != end(); ++l)
|
||||
tmp = (*l)(tmp);
|
||||
|
||||
return tmp;
|
||||
}
|
||||
virtual vector operator()(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
|
||||
|
|
|
|||
Reference in a new issue