MATLAB: Generating a graph from neural network

2d plotgraph

Hi. How to generate a graph from neural network train tool?
Let say for y-axis = MSE and Accuracy, x-axis = number of neuron.
Thanks in advance.

Best Answer

I think if you want to use neural network train tool, then you will need to configure each network separately and save their accuracy and MSE values. It will be easier if you write the code to train your network and then use a for-loop to try different numbers of neurons. Following code shows an example
[x,t] = simplefit_dataset;
N = [1 2 3 5 10 20]; % number of neurons to try
MSE = zeros(size(N));
for i=1:numel(N)
net = feedforwardnet(N(i));
net = train(net, x, t);
y = net(x);
MSE(i) = perform(net,y,t);
end
plot(N, MSE);
xlabel('Neurons');
ylabel('MSE');