A modulatory network architecture which uses two plain backprop networks, each of which is trained separately. When the network is run, each subnetwork is run and the output generated by interpolating between the subnet outputs.
More...
#include <obnet.hpp>
|
virtual void | initWeights (double initr) |
| initialise weights to random values More...
|
|
virtual void | update () |
| Update the two networks, and interpolate linearly between the outputs with the modulator. More...
|
|
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; it can only accept one example. More...
|
|
| Net (NetType tp) |
| Constructor - protected because others inherit it and it's not used directly. More...
|
|
double | drand (double mn, double mx) |
| get a random number using this net's PRNG data More...
|
|
A modulatory network architecture which uses two plain backprop networks, each of which is trained separately. When the network is run, each subnetwork is run and the output generated by interpolating between the subnet outputs.
Definition at line 18 of file obnet.hpp.
OutputBlendingNet::OutputBlendingNet |
( |
int |
nlayers, |
|
|
const int * |
layerCounts |
|
) |
| |
|
inline |
Constructor - does not initialise the weights to random values so that we can reinitialise networks.
- Parameters
-
nlayers | number of layers |
layerCounts | array of layer counts |
Definition at line 33 of file obnet.hpp.
virtual OutputBlendingNet::~OutputBlendingNet |
( |
| ) |
|
|
inlinevirtual |
destructor to delete subnets and outputs
Definition at line 44 of file obnet.hpp.
virtual int OutputBlendingNet::getDataSize |
( |
| ) |
const |
|
inlinevirtual |
Get the length of the serialised data block for this network.
- Returns
- the size in doubles
Implements Net.
Definition at line 80 of file obnet.hpp.
virtual double OutputBlendingNet::getH |
( |
| ) |
const |
|
inlinevirtual |
get the modulator level
Implements Net.
Definition at line 62 of file obnet.hpp.
virtual int OutputBlendingNet::getLayerCount |
( |
| ) |
const |
|
inlinevirtual |
Get the number of layers.
Implements Net.
Definition at line 54 of file obnet.hpp.
virtual int OutputBlendingNet::getLayerSize |
( |
int |
n | ) |
const |
|
inlinevirtual |
Get the number of nodes in a given layer.
- Parameters
-
Implements Net.
Definition at line 50 of file obnet.hpp.
virtual double* OutputBlendingNet::getOutputs |
( |
| ) |
const |
|
inlinevirtual |
Get the outputs after running.
- Returns
- pointer to the output layer outputs
Implements Net.
Definition at line 75 of file obnet.hpp.
virtual void OutputBlendingNet::initWeights |
( |
double |
initr | ) |
|
|
inlineprotectedvirtual |
initialise weights to random values
- Parameters
-
initr | range of weights [-n,n], or -1 for Bishop's rule. |
Implements Net.
Definition at line 104 of file obnet.hpp.
virtual void OutputBlendingNet::load |
( |
double * |
buf | ) |
|
|
inlinevirtual |
Given that the pointer points to a data block of the correct size for the current network, copy the parameters from that data block into the current network overwriting the current parameters.
- Parameters
-
buf | the buffer to load the data from, must be at least getDataSize() doubles |
Implements Net.
Definition at line 92 of file obnet.hpp.
virtual void OutputBlendingNet::save |
( |
double * |
buf | ) |
const |
|
inlinevirtual |
Serialize the data (not including any network type magic number or layer/node counts) to the given memory (which must be of sufficient size).
- Parameters
-
buf | the buffer to save the data, must be at least getDataSize() doubles |
Implements Net.
Definition at line 85 of file obnet.hpp.
virtual void OutputBlendingNet::setH |
( |
double |
h | ) |
|
|
inlinevirtual |
Set the modulator level for subsequent runs and training of this network.
Implements Net.
Definition at line 58 of file obnet.hpp.
virtual void OutputBlendingNet::setInputs |
( |
double * |
d | ) |
|
|
inlinevirtual |
Set the inputs to the network before running or training.
- Parameters
-
d | array of doubles, the size of the input layer |
Implements Net.
Definition at line 68 of file obnet.hpp.
virtual double OutputBlendingNet::trainBatch |
( |
ExampleSet & |
ex, |
|
|
int |
start, |
|
|
int |
num, |
|
|
double |
eta |
|
) |
| |
|
inlineprotectedvirtual |
Train the network - see Net::trainBatch for more details, but this version is only suitable for SGD; it can only accept one example.
- Bug:
- can only use SGD for now; how this works in batching could be tricky.
Implements Net.
Definition at line 133 of file obnet.hpp.
virtual void OutputBlendingNet::update |
( |
| ) |
|
|
inlineprotectedvirtual |
Update the two networks, and interpolate linearly between the outputs with the modulator.
Implements Net.
Definition at line 113 of file obnet.hpp.
double* OutputBlendingNet::interpolatedOutputs |
|
protected |
double OutputBlendingNet::lastError = -1 |
|
protected |
Net* OutputBlendingNet::net0 |
|
protected |
the network trained by h=0 examples
Definition at line 100 of file obnet.hpp.
Net* OutputBlendingNet::net1 |
|
protected |
the network trained by h=1 examples
Definition at line 101 of file obnet.hpp.
The documentation for this class was generated from the following file:
- /home/travis/build/jimfinnis/uesmanncpp/obnet.hpp