How to constrain Neural Network output weights to fixed values
2 ビュー (過去 30 日間)
古いコメントを表示
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

0 件のコメント
回答 (1 件)
Srivardhan Gadila
2020 年 3 月 21 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Sequence and Numeric Feature Data Workflows についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!