Reuse of Weights and Biases in CNN

1 次查看(过去 30 天)
Hamza
Hamza 2023-11-13
编辑: Ayush 2023-12-5
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 个评论
Debraj Maji
Debraj Maji 2023-11-21
编辑:Debraj Maji 2023-11-24
Hello @Hamza,
Can you please clarify on what is meant by weights and biases corresponding to feature 2?

请先登录,再进行评论。

回答(1 个)

Ayush
Ayush 2023-12-5
编辑:Ayush 2023-12-5
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

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by