How to constrain Neural Network output weights to fixed values
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Giovanni Di Girolamo
el 16 de Mzo. de 2020
Comentada: Giovanni Domenico Di Girolamo
el 21 de Mzo. de 2020
Hello everyone,
i have the necessity to train a NN to predict a certain output y(t) given a dataset [x(t) w(t)]. where x and w are signals in time [x(1) x(2)...w(1) w(2)....]
I need the shape of the network to be:
y(k)=F(x(k))+G(x(k))*w(k)
Meaning that i give x and w as input to my network and the training procedure has to learn something like the equation before. F and G can be nonlinear but the relation between G and w has to be G(x)*w and this last product has to sum with F.
By playing with layers of NN i defined this structure in the image attached. My idea is to "fix" weights on the output layer to be 1 and w(k).
How can i do this in matlab? Is it possible to do this?
Thanks in advance
Best
Gianni![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/277526/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/277526/image.png)
0 comentarios
Respuestas (1)
Srivardhan Gadila
el 21 de Mzo. de 2020
You can access the layer weights as follows:
net.LW{i,j}
You can set any values to the above weights and set the net.layerWeights{i,j}.learn to 0 so that the weights won't be altered during the training & adaption. In this case setting a specific weight for a connection is not possible since the property net.layerWeights{i,j}.learn is defined for the entire connections between layers i and j.
net.layerWeights{i,j}.learn = 0
net.LW{i,j} = ones(size(net.LW{i,j})) % any weights of size(net.LW{i,j})
If your network architecture is defined and trained already:
Then you can set weight of a connection between nodes k & l of layers i & j as follows:
net.LW{i,j}(k,l) = 1
and then use the network.
The above things can be done to Input wieghts too.
1 comentario
Ver también
Categorías
Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!