Main Content


Plot network performance



plotperform(TR) plots error vs. epoch for the training, validation, and test performances of the training record TR returned by the function train.


collapse all

This example shows how to use plotperform to obtain a plot of training record error values against the number of training epochs.

[x,t] = bodyfat_dataset;
net = feedforwardnet(10);
[net,tr] = train(net,x,t);

Figure Neural Network Training (19-Aug-2023 11:57:32) contains an object of type uigridlayout.


Figure Performance (plotperform) contains an axes object. The axes object with title Best Validation Performance is 26.6393 at epoch 9, xlabel 15 Epochs, ylabel Mean Squared Error (mse) contains 6 objects of type line. One or more of the lines displays its values using only markers These objects represent Train, Validation, Test, Best.

Generally, the error reduces after more epochs of training, but might start to increase on the validation data set as the network starts overfitting the training data. In the default setup, the training stops after six consecutive increases in validation error, and the best performance is taken from the epoch with the lowest validation error.

Input Arguments

collapse all

Training record (epoch and perf), returned as a structure whose fields depend on the network training function (net.NET.trainFcn). It can include fields such as:

  • Training, data division, and performance functions and parameters

  • Data division indices for training, validation and test sets

  • Data division masks for training validation and test sets

  • Number of epochs (num_epochs) and the best epoch (best_epoch)

  • A list of training state names (states)

  • Fields for each state name recording its value throughout training

  • Performances of the best network (best_perf, best_vperf, best_tperf)

Version History

Introduced in R2008a