Documentation |
Conscience bias learning function
[dB,LS] = learncon(B,P,Z,N,A,T,E,gW,gA,D,LP,LS)
info = learncon('code')
learncon is the conscience bias learning function used to increase the net input to neurons that have the lowest average output until each neuron responds approximately an equal percentage of the time.
[dB,LS] = learncon(B,P,Z,N,A,T,E,gW,gA,D,LP,LS) takes several inputs,
B | S-by-1 bias vector |
P | 1-by-Q ones vector |
Z | S-by-Q weighted input vectors |
N | S-by-Q net input vectors |
A | S-by-Q output vectors |
T | S-by-Q layer target vectors |
E | S-by-Q layer error vectors |
gW | S-by-R gradient with respect to performance |
gA | S-by-Q output gradient with respect to performance |
D | S-by-S neuron distances |
LP | Learning parameters, none, LP = [] |
LS | Learning state, initially should be = [] |
and returns
dB | S-by-1 weight (or bias) change matrix |
LS | New learning state |
Learning occurs according to learncon's learning parameter, shown here with its default value.
LP.lr - 0.001 | Learning rate |
info = learncon('code') returns useful information for each supported code string:
'pnames' | Names of learning parameters |
'pdefaults' | Default learning parameters |
'needg' | Returns 1 if this function uses gW or gA |
Neural Network Toolbox™ 2.0 compatibility: The LP.lr described above equals 1 minus the bias time constant used by trainc in the Neural Network Toolbox 2.0 software.
Here you define a random output A and bias vector W for a layer with three neurons. You also define the learning rate LR.
a = rand(3,1); b = rand(3,1); lp.lr = 0.5;
Because learncon only needs these values to calculate a bias change (see "Algorithm" below), use them to do so.
dW = learncon(b,[],[],[],a,[],[],[],[],[],lp,[])
To prepare the bias of layer i of a custom network to learn with learncon,
Set net.trainFcn to 'trainr'. (net.trainParam automatically becomes trainr's default parameters.)
Set net.adaptFcn to 'trains'. (net.adaptParam automatically becomes trains's default parameters.)
Set each net.layerWeights{i,j}.learnFcn to 'learncon'. .(Each weight learning parameter property is automatically set to learncon's default parameters.)
To train the network (or enable it to adapt),