Reuse of Weights and Biases in CNN
2 次查看(过去 30 天)
显示 更早的评论
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
2023-11-21
编辑:Debraj Maji
2023-11-24
Can you please clarify on what is meant by weights and biases corresponding to feature 2?
回答(1 个)
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:
- Prepare Feature-2 data: Prepare your training dataset using only feature 2 with dimensions 60095×1.
- Create a new network. You can use functions like “feedforwardnet” for this operation.
- Set the weights and biases of the network using properties again.
- Training the new network using “train” function .
For more information on “feedforwardnet” and “train” , refer to the MathWorks documentation link below:
- https://www.mathworks.com/help/deeplearning/ref/feedforwardnet.html
- https://www.mathworks.com/help/deeplearning/ref/network.train.html
Hope this helps!
Regards,
Ayush Goyal
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!