%% Train Neural Network Using mse Performance Function
% This example shows shows how to train a neural network using the mse performance function.
% Here a two-layer feedforward network is created and trained to estimate body fat percentage using the mse performance function and a regularization value of 0.01.

[x, t] = bodyfat_dataset;
net = feedforwardnet(10);
net.performParam.regularization = 0.01;

%
% MSE is the default performance function for feedforwardnet.

net.performFcn

%
% Train the network and evaluate performance.

net = train(net, x, t);
y = net(x);
perf = perform(net, t, y)

%
% Alternatively, you can call mse directly.

perf = mse(net, t, y, 'regularization', 0.01)

% Copyright 2012 The MathWorks, Inc.