data and nn input sizes do not match..
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
my neural network is supposed to take an coloumn vector input [7x1] and output a value 1-3 that refers to a certain condition.
the way i have these set up is below, as well as a copy of the network code.
when i try to run this, i get an error "the numbers of input signals and networks inputs do not match"
this happens when i try to use net=configure(net, input), using my dataset.
im new to matlab so let me know if the mistake is just somewhere simple, ill have trouble finding it...
data= {temp;humid;SLP;precip;SWR;wind;dir};
%make a variable that treats all our coloumns as a matrix. i put this here
%and used it below to try and make the code work but it is making a 7 x 1
%cell instead of a 7x38000 matrix of all my input sets.
predictionNet=network;
predictionNet.name='PredictNet';
predictionNet.numInputs= 7;
predictionNet.numLayers= 5;
%first three lines are just initialization of the predictionNetwork.
predictionNet.biasConnect=[1;1;1;1;1];
%select which layers we want biases for
predictionNet.inputConnect=[1 1 1 1 1 1 0
0 0 0 0 0 0 1
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0];
%boolean matrix of T/F connections between inputs and weights
predictionNet.outputConnect=[0 0 0 0 1];
%select which layers will connect to the final output
predictionNet.layerConnect=[0 0 0 0 0
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0];
%outlines which layer you want to feed into a current layer out of all
%layers
predictionNet.layers{1}.size=10;
predictionNet.layers{2}.size=20;
predictionNet.layers{3}.size=20;
predictionNet.layers{4}.size=15;
predictionNet.layers{5}.size=1;
%set number of neurons in each layer. the last layer has to be size 1 to
%get an indication of warning/fire/safe
predictionNet.layers{1}.transferFcn='tansig';
predictionNet.layers{1}.initFcn='initnw';
predictionNet.layers{2}.transferFcn = 'logsig';
predictionNet.layers{2}.initFcn = 'initnw';
predictionNet.layers{3}.transferFcn = 'logsig';
predictionNet.layers{3}.initFcn = 'initnw';
predictionNet.layers{4}.transferFcn = 'logsig';
predictionNet.layers{4}.initFcn = 'initnw';
predictionNet.layers{5}.transferFcn = 'logsig';
predictionNet.layers{5}.initFcn = 'initnw';
%set the transfer function and the initial functions.
%i chose tansig for the first so everything is centered around a mean, and
%then I chose logsig so everything is more probabalistic.
predictionNet.initFcn= 'initlay';
predictionNet.trainFcn='trainlm';
predictionNet.divideFcn='dividerand';
%divides training data randomly
predictionNet.plotFcns={'plotperform','plottrainstate'};
%choosing which plots i want when the data is read.
predictionNet= train(predictionNet, data, output);
view(predictionNet);
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Define Shallow Neural Network Architectures finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!