How do I see the weight and biases variables in neural networks, please show me on simple example code?
47 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Radek
el 2 de Jun. de 2015
Respondida: Gene Pennello
el 25 de Feb. de 2022
How do I see the weight and biases variables in neural networks, please show me on simple example code?
1 comentario
Matthew Eicholtz
el 2 de Jun. de 2015
It depends. Are you using the built-in Neural Network Toolbox or building one from scratch?
Respuesta aceptada
Matthew Eicholtz
el 2 de Jun. de 2015
Copying from there, one example deals with classifying the sex of crabs.
[x,t] = crab_dataset; %load the dataset
net = patternnet(10); %create the network
[net,tr] = train(net,x,t); %train the network
Now, you can find the weights and biases by looking at net .
w1 = net.IW{1} %the input-to-hidden layer weights
w2 = net.LW{2} %the hidden-to-output layer weights
b1 = net.b{1} %the input-to-hidden layer bias
b2 = net.b{2} %the hidden-to-output layer bias
Hope this helps.
2 comentarios
Subhadarshini Jati
el 14 de Oct. de 2020
this provides only one set of weights associated to a single input. what if i need all weights associated with all inputs?
Más respuestas (2)
Ava harry
el 10 de Sept. de 2019
How about havng 2 hidden layers? how can I extract bias and weights between them?
Gene Pennello
el 25 de Feb. de 2022
https://www.mathworks.com/matlabcentral/answers/398531-how-to-manually-calculate-a-neural-network-output
0 comentarios
Ver también
Categorías
Más información sobre Define Shallow Neural Network Architectures en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!