Bounded neural network output
古いコメントを表示
Hi guys,
I have a couple of questions related to NNs. I want to define a neural network in which outputs are bounded in a user-defined range. How could I do that?
First thing I tried was to change the output transfer function to tansig, expecting the output to be in the range [-1, 1]. Well, it doesn't. Any idea why?
Then, during some tweaking, I've tried to set all the weights and biases of the net to zero, and expected at least to see a zero output. Well, again, the output is 1.5. Why? What am I missing?
Here the code I've experimented with.
HIDDEN_LAYER_SIZE = 10;
net = fitnet(HIDDEN_LAYER_SIZE);
% cheating to set input and output dimensions
x = [1 1 1; 2 2 2]'; t = [1 1; 2 2]';
net = configure(net, x, t);
net.layers{2}.transferFcn = 'tansig';
display('TANSIG OUTPUT');
net([1 1 1]') % expecting something in [-1, 1]
display('TANSIG OUTPUT WITH ALL ZERO W and b');
net = setwb(net,zeros(1,net.numWeightElements));
net([1 1 1]') % expecting 0
Output:
TANSIG OUTPUT
ans =
1.0254
1.0338
TANSIG OUTPUT WITH ALL ZERO W and b
ans =
1.5000
1.5000
Any help will be highly appreciated!
All the best,
Francesco
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Function Approximation and Nonlinear Regression についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!