How to use the training weights and Biases for testing a Neural Network

3 visualizaciones (últimos 30 días)
In my Neural network implemented usign backpropagation in Matlab, I train the network for a regression problem with 98000 data points, I calculate the training accuracy for each epoch and then save weights and biases in a .mat file for testing.
Since my training data has 98000 points, therefore there are 98000 possile weight matrices in the .mat file.
Network Architecture: I-H1-O´= 5-8-1
I have the following questions:
  1. How to select the weight at which I should start the testing?
  2. Since during testing, there are no updates on weight, does it mean that I use only 1 weight and bias matrix for testing?
  3. Should I be selecting the weight and bias corresponding to minimum error in training set? If not, what else shoud be the criteria for selection?
Any leads would be appreciated.

Respuesta aceptada

Anant Upadhyay
Anant Upadhyay el 7 de Mzo. de 2019
A better approach would be to “save the network after training”, and then use the “saved network” to predict output on “test data”.
The reason behind using the “saved network” to predict the output on “test data” is that, back propagation works to minimize the “loss function” of your network, and network learns the most suitable values of “weights and biases”. Hence, after training the network, the values of “weights and biases” would be such that they minimize the error function.
However, if you want to experiment with different values of weights and biases, you can load the values of “weights and biases” from your “.mat file”.
To save your model after training, you can look for documentation of “save”:
You can look the below code for your reference:
net = feedforwardnet(10);
net = configure(net,x,t);
% where “x” is input and “t” is target
my_model = net;
save my_model;
% Now to use the saved network on test data, first load the “saved network”
load my_model
newoutput = my_model(newinput);
  4 comentarios
Zeeshan Ahmad Khan
Zeeshan Ahmad Khan el 7 de Mzo. de 2019
Can I also save the weights and biases corresponding to the minimum value of error from training and then use these weights and biases for testing as well?
Will it likely give correct results?
Anant Upadhyay
Anant Upadhyay el 7 de Mzo. de 2019
You can use any weights and biases for testing. The purpose of training a neural network is to learn the optimal value of "weights and biases" to reduce the loss function/minimize the error.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by