Neural network training fails when target values are small. Mapminmax issue?
Show older comments
When I try to train a network with very small targets the training stops at epoch 0 (i.e., does not begin at all) because the gradient is already too small. I understand that a very small target could imply a very small gradient but the mapminmax function is active and it should map the target in [-1,1] avoiding this kind of problems. So what's going on?
Here's some code:
First I define a really small sine wave:
in = [0:0.1:10];
out = sin(in)/1e10;
then I create and configure a network
net = fitnet([15]);
net = configure(net,in,out);
The mapminmax function seems to be active and properly configured:
net.outputs{1,2}.processSettings{1,2}
ans =
name: 'mapminmax'
xrows: 1
xmax: 9.9957e-11
xmin: -9.9992e-11
xrange: 1.9995e-10
yrows: 1
ymax: 1
ymin: -1
yrange: 2
no_change: 0
gain: 1.0003e+10
xoffset: -9.9992e-11
but the training fails (it stops at epoch 0):
[net,tr] = train(net,in,out);
tr.stop
ans =
Minimum gradient reached.
tr.num_epochs
ans =
0
The learning completely failed, this is the output of the net:

But if I manually use mapminmax everything works well
net = configure(net,in,mapminmax(out,-1,1));
[net,tr] = train(net,in,mapminmax(out,-1,1));
tr.stop
ans =
Minimum gradient reached.
tr.num_epochs
ans =
377
And the network actually learned the sine function:

Any ideas?
Accepted Answer
More Answers (0)
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!