How to constrain Neural Network output?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
hinami
am 22 Sep. 2020
Beantwortet: Aditya Patil
am 25 Sep. 2020
Hi,
For my research purpose, I need to impose a constrain for the output layer. How to constrain the output values?
x = rand([3,100]);
t = rand([2,100]);
net = feedforwardnet([5 10]);
net = configure(net,x,t);
[net tr]=train(net,x,t);
mod=net(x(:,tr.testInd));
sum(mod)
>>ans =
Columns 1 through 8
1.2481 1.3790 1.2986 1.3004 1.2728 1.4082 1.2895 1.3355
Columns 9 through 15
1.3199 1.3409 1.2890 1.2890 1.3402 1.2568 1.3171
The above code is just an example.
As you can see, the sum of output values beyond 1, but I'd like to constrain the sum of the output values to be exactly equal to 1.
Could anyone help me?
0 Kommentare
Akzeptierte Antwort
Aditya Patil
am 25 Sep. 2020
If you are trying to get outputs as probabilities, then you can use the softmax layer with a neural network. Feedforward network is a simple network that might not be appropriate for your task.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!