How works linear neural network ?

1 visualización (últimos 30 días)
guigui zizouniet
guigui zizouniet el 9 de Nov. de 2018
Hi there,
I'm creating a simple 1-layer NN, using the 'purelin' function. My net has 2 inputs and 1 output. The weights are approximately 0.3339 and -0.1704, and the bias is 0.1152. When I launch net([0.5 ; 0.5]), I get 2.51 as a result, but when I compute myself 0.5*0.3339+0.5-0.1704+0.1152=0.196. I don't understand how this 'purelin' function works, can you help me ? The same problem appears when I use the 'satlins' function : the result shouldn't be greater than 1 but it is. I can't explain that.
Net creation
learningRate = '0.000001';
structure = [];
net = feedforwardnet(structure);
net.trainFcn = 'trainlm';
net.trainParam.lr = learningRate;
for i = 1:net.numLayers-1
net.layers{i}.transferFcn = 'satlins';
end
net.layers{net.numLayers}.transferFcn = 'purelin';
Training data creation
x = rand(2, 10000);
x1 = x(1, :);
x2 = x(2, :);
t = sin(x1*10)./(x1*10)+exp(x1)+cos(x2.*x2)./(x1+1);
figure
plot3(x1, x2, t, '.')
Net training
net = train(net, x, t, 'useGpu','yes');
Net application
xtest = rand(2, 5000);
x1test = xtest(1, :);
x2test = xtest(2, :);
hold on
plot3(x1test, x2test, net(xtest), '.r')
Thanks in advance for your help

Respuestas (0)

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by