Linear Neural Network add another linear layer
I have written a program for training a linear neural network for classification. Both the input and the output are 3 row vectors and I need a each node to have a linear transfer function. I have used the linearlayer type as you can see in the code below;
function trainLNN(P, T)
%P = [1.7300 1.9500 2.3800; 1.4400 5.0000 4.7500; 3.4000 3.2000 3.3000];
%T = [ 0 1 0; 1 0 0; 0 0 1];
net = linearlayer;
net.trainParam.epochs = 1000;
net.trainParam.goal = 0.1;
net.trainParam.lr = 0.001;
net.trainParam.lr = maxlinlr(P,’bias’);
net = train(net,P, T);
What I get is a neural network with just an input and an output layer (see the photo below).
How can I extend that to add a hidden layer between the input and the output layers to have a network like the one in the photo with all nodes having a linear transfer function? I have tried net = linearlayer(P,T, 3, {‘purelin’, ‘purelin’}); but I get an error ("Too many parameter arguments");I have written a program for training a linear neural network for classification. Both the input and the output are 3 row vectors and I need a each node to have a linear transfer function. I have used the linearlayer type as you can see in the code below;
function trainLNN(P, T)
%P = [1.7300 1.9500 2.3800; 1.4400 5.0000 4.7500; 3.4000 3.2000 3.3000];
%T = [ 0 1 0; 1 0 0; 0 0 1];
net = linearlayer;
net.trainParam.epochs = 1000;
net.trainParam.goal = 0.1;
net.trainParam.lr = 0.001;
net.trainParam.lr = maxlinlr(P,’bias’);
net = train(net,P, T);
What I get is a neural network with just an input and an output layer (see the photo below).
How can I extend that to add a hidden layer between the input and the output layers to have a network like the one in the photo with all nodes having a linear transfer function? I have tried net = linearlayer(P,T, 3, {‘purelin’, ‘purelin’}); but I get an error ("Too many parameter arguments"); I have written a program for training a linear neural network for classification. Both the input and the output are 3 row vectors and I need a each node to have a linear transfer function. I have used the linearlayer type as you can see in the code below;
function trainLNN(P, T)
%P = [1.7300 1.9500 2.3800; 1.4400 5.0000 4.7500; 3.4000 3.2000 3.3000];
%T = [ 0 1 0; 1 0 0; 0 0 1];
net = linearlayer;
net.trainParam.epochs = 1000;
net.trainParam.goal = 0.1;
net.trainParam.lr = 0.001;
net.trainParam.lr = maxlinlr(P,’bias’);
net = train(net,P, T);
What I get is a neural network with just an input and an output layer (see the photo below).
How can I extend that to add a hidden layer between the input and the output layers to have a network like the one in the photo with all nodes having a linear transfer function? I have tried net = linearlayer(P,T, 3, {‘purelin’, ‘purelin’}); but I get an error ("Too many parameter arguments"); linear neural network, matlab, linearlayer MATLAB Answers — New Questions