Documentation Center

  • Trial Software
  • Product Updates

Contents

trainbr

Bayesian regulation backpropagation

Syntax

net.trainFcn = 'trainbr'
[net,tr] = train(net,...)

Description

trainbr is a network training function that updates the weight and bias values according to Levenberg-Marquardt optimization. It minimizes a combination of squared errors and weights, and then determines the correct combination so as to produce a network that generalizes well. The process is called Bayesian regularization.

net.trainFcn = 'trainbr'

[net,tr] = train(net,...)

Training occurs according to trainbr's training parameters, shown here with their default values:

net.trainParam.epochs100

Maximum number of epochs to train

net.trainParam.goal0

Performance goal

net.trainParam.mu0.005

Marquardt adjustment parameter

net.trainParam.mu_dec0.1

Decrease factor for mu

net.trainParam.mu_inc10

Increase factor for mu

net.trainParam.mu_max1e10

Maximum value for mu

net.trainParam.max_fail0

Maximum validation failures

net.trainParam.mem_reduc1

Factor to use for memory/speed tradeoff

net.trainParam.min_grad1e-10

Minimum performance gradient

net.trainParam.show25

Epochs between displays (NaN for no displays)

net.trainParam.showCommandLine0

Generate command-line output

net.trainParam.showWindow1

Show training GUI

net.trainParam.timeinf

Maximum time to train in seconds

Validation stops are disabled by default (max_fail = 0) so that training can continue until an optimal combination of errors and weights is found. However, some weight/bias minimization can still be achieved with shorter training times if validation is enabled by setting max_fail to 6 or some other strictly positive value.

Network Use

You can create a standard network that uses trainbr with feedforwardnet or cascadeforwardnet. To prepare a custom network to be trained with trainbr,

  1. Set NET.trainFcn to 'trainbr'. This sets NET.trainParam to trainbr's default parameters.

  2. Set NET.trainParam properties to desired values.

In either case, calling train with the resulting network trains the network with trainbr. See feedforwardnet and cascadeforwardnet for examples.

Examples

Here is a problem consisting of inputs p and targets t to be solved with a network. It involves fitting a noisy sine wave.

p = [-1:.05:1];
t = sin(2*pi*p)+0.1*randn(size(p));

A feed-forward network is created with a hidden layer of 2 neurons.

net = feedforwardnet(2,'trainbr');

Here the network is trained and tested.

net = train(net,p,t);
a = net(p)

Limitations

This function uses the Jacobian for calculations, which assumes that performance is a mean or sum of squared errors. Therefore networks trained with this function must use either the mse or sse performance function.

More About

expand all

Algorithms

trainbr can train any network as long as its weight, net input, and transfer functions have derivative functions.

Bayesian regularization minimizes a linear combination of squared errors and weights. It also modifies the linear combination so that at the end of training the resulting network has good generalization qualities. See MacKay (Neural Computation, Vol. 4, No. 3, 1992, pp. 415 to 447) and Foresee and Hagan (Proceedings of the International Joint Conference on Neural Networks, June, 1997) for more detailed discussions of Bayesian regularization.

This Bayesian regularization takes place within the Levenberg-Marquardt algorithm. Backpropagation is used to calculate the Jacobian jX of performance perf with respect to the weight and bias variables X. Each variable is adjusted according to Levenberg-Marquardt,

jj = jX * jX
je = jX * E
dX = -(jj+I*mu) \ je

where E is all errors and I is the identity matrix.

The adaptive value mu is increased by mu_inc until the change shown above results in a reduced performance value. The change is then made to the network, and mu is decreased by mu_dec.

The parameter mem_reduc indicates how to use memory and speed to calculate the Jacobian jX. If mem_reduc is 1, then trainlm runs the fastest, but can require a lot of memory. Increasing mem_reduc to 2 cuts some of the memory required by a factor of two, but slows trainlm somewhat. Higher values continue to decrease the amount of memory needed and increase the training times.

Training stops when any of these conditions occurs:

  • The maximum number of epochs (repetitions) is reached.

  • The maximum amount of time is exceeded.

  • Performance is minimized to the goal.

  • The performance gradient falls below min_grad.

  • mu exceeds mu_max.

References

MacKay, Neural Computation, Vol. 4, No. 3, 1992, pp. 415–447

Foresee and Hagan, Proceedings of the International Joint Conference on Neural Networks, June, 1997

See Also

| | | | | | | | | | |

Was this topic helpful?