Reuse of Weights and Biases in CNN

1 visualizzazione (ultimi 30 giorni)
Hamza
Hamza il 13 Nov 2023
Modificato: Ayush il 5 Dic 2023
Hello everyone, I have applied a 1D CNN to a training dataset with dimensions 60095×39 and obtained the attached network. Now, I would like to extract the weights and biases corresponding to feature 2 (column 2) and then retrain the network using only feature 2 with dimensions 60095×1, utilizing the weights from the previous training. Could you please guide me on how to achieve this?
You can find the attached network.
Thanks in advance.
  1 Commento
Debraj Maji
Debraj Maji il 21 Nov 2023
Modificato: Debraj Maji il 24 Nov 2023
Hello @Hamza,
Can you please clarify on what is meant by weights and biases corresponding to feature 2?

Accedi per commentare.

Risposte (1)

Ayush
Ayush il 5 Dic 2023
Modificato: Ayush il 5 Dic 2023
Hey Hamza,
I understand that you have a trained network with 39 features and 60095 data points. You want to extract the weights and biases corresponding to feature 2 (column 2) from the trained network. After extracting these parameters, you aim to retrain the new network using only feature 2 data with dimensions 60095×1, while utilizing the weights from the previous training.
To extract the weights and biases corresponding to feature 2 from the trained network, you can access these parameters using the network's property fields. Here's an example of how you might extract the weights and biases for feature 2 in MATLAB:
% Assuming your trained network is named 'trainedNet
weightsLayer2 = trainedNet.Layers(2).Weights; % Extract weights for the second layer
biasesLayer2 = trainedNet.Layers(2).Bias; % Extract biases for the second layer
For retraining the network using feature-2 , you can follow these steps:
  1. Prepare Feature-2 data: Prepare your training dataset using only feature 2 with dimensions 60095×1.
  2. Create a new network. You can use functions like “feedforwardnet” for this operation.
  3. Set the weights and biases of the network using properties again.
  4. Training the new network using “train” function .
For more information on “feedforwardnet” and “train” , refer to the MathWorks documentation link below:
  1. https://www.mathworks.com/help/deeplearning/ref/feedforwardnet.html
  2. https://www.mathworks.com/help/deeplearning/ref/network.train.html
Hope this helps!
Regards,
Ayush Goyal

Categorie

Scopri di più su Deep Learning Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by