How to interpret an answer given by the Neural Network?

1 view (last 30 days)
Hi.
I create a neural network with four(4) inputs and one(1) target (including 104 data for each one)with three(3) hidden layer. my script is as follows:
inputs = x; targets = y;
% Create a Fitting Network hiddenLayerSize = 3; net = fitnet(hiddenLayerSize);
% Setup Division of Data for Training, Validation, Testing net.divideParam.trainRatio = 70/100; net.divideParam.valRatio = 15/100; net.divideParam.testRatio = 15/100;
% Train the Network [net,tr] = train(net,inputs,targets);
% Test the Network outputs = net(inputs); errors = gsubtract(targets,outputs); performance = perform(net,targets,outputs)
% View the Network view(net)
In this case, I would like to extract coefficient of input data for 105th data. for example, for a equation like (X1a+X2b+X3c+X4d), I need to find X1,X2,X3,X4. How can I extract these coefficient from neural network?
Thank you very much for your answer.

Answers (1)

Greg Heath
Greg Heath on 28 Jul 2015
Please
1. Format your post so that comments and executables are on different lines
2. Use the notations
a. Matrices: lower case; Cells: uppercase
Inputs: x, X
Targets t, T
Outputs y, Y
b. No. of hidden nodes h, H
3. inputs = x; targets = t; H =3
[ I N ]= = size(x) % [ 4 104]
[ O N ] = size(t) % [ 1 104 ]
MSE00 = var(t,1) % Reference MSE
net = fitnet(H);
% Default datadivision (0.7/0/15/0.15)
[ net tr y e ] = train( net, x , t);
% y = net(x); e = t-y;
NMSE = mse(e)/MSE00 % Normalized MSE
R2 = 1 - NMSE % Rsquared, Coefficient of Determination
% https://en.wikipedia.org/wiki/R2
% View the Network
view(net)
>In this case, I would like to extract coefficient of input data for 105th data. for example, for a equation like (X1a+X2b+X3c+X4d), I need to find X1,X2,X3,X4. How can I extract these coefficient from neural network?
You are confused. Let the input and target be
x = [ x1 ; x2; x3; x4 ] ; % [ 4 104 ]
t = a + b*x1 +c*x2 + d*x3 + e*x4 ; % [ 1 104]
x1, x2, x3, x4 and t are known. Find a,b,c,d,e
This is a trivial linear case which can be solved by the slash solution
N = 104, y = W*[ ones(1,N) ;x ]
where
W = t / [ ones(1,N) ; x ]
It can also be solved using a neural net with 0 hidden nodes:
net = fitnet([]);
I will let you compare the 2 solutions after plugging in the numerics.
Hope this helps.
Thank you for formally accepting my answer
Greg

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!