mesllo
mesllo

Reputation: 583

MATLAB Neural Network Performance data structures

I am approximating a cosine function using a neural network on MATLAB. When training is finished, a number of data structures are outputted on the workspace. Amongst these are 4 structures (well, values really) which contain the performance results of the network.

For the performance analysis, you get a performance structure, trainPerformance, testPerformance and valPerformance.

While I know what the last three structures mean, the first one is confusing me as it is a different value than the others.

I'm using the Neural Network Toolbox.

% Train the Network
[net,tr] = train(net,inputs,targets);

% Test the Network
outputs = net(inputs);
errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs)

% Recalculate Training, Validation and Test Performance
trainTargets = targets .* tr.trainMask{1};
valTargets = targets  .* tr.valMask{1};
testTargets = targets  .* tr.testMask{1};
trainPerformance = perform(net,trainTargets,outputs)
valPerformance = perform(net,valTargets,outputs)
testPerformance = perform(net,testTargets,outputs)

What is the difference between the performance structure and the other three?

I think I just realised that the performance is the overall result of the network, and the trainPerformance is for the current iteration.

Upvotes: 1

Views: 1053

Answers (1)

Ander Biguri
Ander Biguri

Reputation: 35525

While doing Neural Networks you usually take your data and divide it into 3 subsets: Training, Validation and Test. Someone has a quite good questiond and answer in this site about what these are and why:

whats is the difference between train, validation and test set, in neural networks?

In your case, It looks like you test the performance in each of these subsets of your data and in the whole set of data also! Therefore, performance is the performance of the NN using all data, and train/val/test-performance are the performance for each of the mentioned subsets of data.

Make sure you understand properly what these 3 subsets are, as it is crucial for understanding the performance of your NN

Upvotes: 1

Related Questions