How can I use fitnet coefficients of my older neural network in training a new one?

3 views (last 30 days)
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?

Answers (1)

Prasanna
Prasanna on 4 Dec 2024
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:

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!