Linear Neural Network poor performance

1 view (last 30 days)
Triple G
Triple G on 12 Jun 2020
Edited: Triple G on 12 Jun 2020
I have been asked to build a linear neural network with a single hidden layer. All the layers (input, hidden and output) should have 3 nodes. So I have written the following code so far, with P and T a sample of the dataset:
P = [1.7500 1.8000 2.4000 1.4000; 3.3500 3.3000 3.3000 4.0000 ;4.2000 3.9500 2.5500 6.8000];
T = [0 0 0 1; 1 1 0 0; 0 0 1 0];
function testFF(P, T)
net = newff(P,T,3, {'purelin'});
net.trainParam.showCommandLine = 1;
net.trainParam.goal = 0.0001;
net.trainParam.lr = 0.1;
net.trainFcn = 'traingd';
net = train(net,P,T);
% Check network performance on training patterns.
EstimatedTrainingTargets = sim(net,P);
EstimatedTrainingTargets = round(EstimatedTrainingTargets);
Differences = abs(EstimatedTrainingTargets - T);
CorrectTrainClassificationRatio = 1 - (sum(sum(Differences)) / (2*size(P,2)))
First of all, is the above a valid implementation of a linear neural network?
Secondly, after I feed the input and output matrices, whose size is 3 X 22000, the networks prediction isnt accurate at all , for example for the first 4 inputs as given above, the output is:
0 0 0 0
0 0 0 0
0 0 0 0
and the CorrectTrainClassificationRatio for the whole data set is 0.4713.
I have tried different learning rates, training functions and parameters goals but the outcome doesn't change by much. How can I get better predictions?

Answers (0)

Categories

Find more on Sequence and Numeric Feature Data Workflows 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!