How can I use fitnet coefficients of my older neural network in training a new one?
Afficher commentaires plus anciens
Hi everyone,
I am using neural network for function fitting using fitnet command. First, I trained it using some inputs my input is a matrix 231x5000 and target is 8x5000. Now I want to add new inputs to my input matrix and to train a new neural network. The new input would be (231 + y)x5000 and the target is the same as on old problem 8x5000. How can I use the coefficients that I obtained from the first model in order to increase the computation time?
Réponses (1)
Prasanna
le 4 Déc 2024
0 votes
Hi Vahagn,
To use the weights and biases from your first trained neural network to initialize a new network with additional inputs, you can refer these steps:
- Extract the weights and biases from the first model using the ‘getwb’ function.
- Create the new network with the updated input size using the ‘fitnet’ method. The ‘fitnet’ method returns a function fitting neural network with a new hidden layer size.
- Initialize the new network with the extracted weights using the ‘setwb’ function. You may need to adjust the weights to match the new input size accordingly.
- Train the new network with the updated input data.
For more information regarding the functions used, refer the following documentations:
- ‘getwb’: https://www.mathworks.com/help/deeplearning/ref/getwb.html
- ‘fitnet’: https://www.mathworks.com/help/deeplearning/ref/fitnet.html
- ‘setwb’: https://www.mathworks.com/help/deeplearning/ref/setwb.html
- Initialize neural network to set of weights: https://www.mathworks.com/matlabcentral/answers/50961-how-to-initialize-the-neural-network-to-a-set-of-weights
- Set a specific weight for a connection in neural networks: https://www.mathworks.com/matlabcentral/answers/499607-set-a-specific-weight-for-a-connection-in-neural-networks
Catégories
En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!