58 virtual void setH(
double h){
62 virtual double getH()
const {
85 virtual void save(
double *buf)
const {
92 virtual void load(
double *buf){
122 interpolatedOutputs[i] = h*o1[i] + (1.0-h)*o0[i];
137 std::runtime_error(
"num!=1 (i.e. batch training) not implemented");
141 double hzero = (ex.
getH(start)<0.5);
142 Net *net = hzero ? net0 :
net1;
NetType
The different types of network - each has an associated integer for saving/loading file data...
virtual int getLayerCount() const =0
Get the number of layers.
virtual void update()
Update the two networks, and interpolate linearly between the outputs with the modulator.
OutputBlendingNet(int nlayers, const int *layerCounts)
Constructor - does not initialise the weights to random values so that we can reinitialise networks...
A modulatory network architecture which uses two plain backprop networks, each of which is trained se...
virtual void save(double *buf) const =0
Serialize the data (not including any network type magic number or layer/node counts) to the given me...
virtual int getLayerCount() const
Get the number of layers.
virtual ~OutputBlendingNet()
destructor to delete subnets and outputs
The "basic" back-propagation network using a logistic sigmoid, as described by Rumelhart, Hinton and Williams (and many others). This class is used by output blending and h-as-input networks.
int getOutputCount() const
get the number of outputs
virtual void save(double *buf) const
Serialize the data (not including any network type magic number or layer/node counts) to the given me...
virtual int getLayerSize(int n) const
Get the number of nodes in a given layer.
virtual double * getOutputs() const =0
Get the outputs after running.
virtual int getDataSize() const
Get the length of the serialised data block for this network.
Contains formats for example data.
virtual void setInputs(double *d)=0
Set the inputs to the network before running or training.
Net * net1
the network trained by h=1 examples
virtual int getLayerSize(int n) const =0
Get the number of nodes in a given layer.
double * interpolatedOutputs
the interpolated result after update()
virtual void setH(double h)
Set the modulator level for subsequent runs and training of this network.
virtual void initWeights(double initr)
initialise weights to random values
virtual double getH() const
get the modulator level
virtual void initWeights(double initr)=0
initialise weights to random values
virtual double trainBatch(ExampleSet &ex, int start, int num, double eta)=0
Train a network for batch (or mini-batch) (or single example).
virtual double trainBatch(ExampleSet &ex, int start, int num, double eta)
Train the network - see Net::trainBatch for more details, but this version is only suitable for SGD; ...
virtual double * getOutputs() const
Get the outputs after running.
virtual void update()=0
Run a single update of the network.
virtual int getDataSize() const =0
Get the length of the serialised data block for this network.
virtual void load(double *buf)=0
Given that the pointer points to a data block of the correct size for the current network...
virtual void setInputs(double *d)
Set the inputs to the network before running or training.
virtual void load(double *buf)
Given that the pointer points to a data block of the correct size for the current network...
Net * net0
the network trained by h=0 examples
double getH(int example) const
Get the h (modulator) for a given example.
The abstract network type upon which all others are based. It's not pure virtual, in that it encapsul...
A set of example data. Each datum consists of hormone (i.e. modulator value), inputs and outputs...