MATLAB Answers

1-D CNN network using data array in Matlab.

8 views (last 30 days)
Fahmida Haque
Fahmida Haque on 24 Jun 2020
Edited: Fahmida Haque on 24 Jun 2020
data1= readtable('training.xlsx');
A= table2array(data1);
targetD= categorical(A(:,4));
trainD = (A(:,1:3));
trainDNew = reshape(trainD', [1,3,1,7034]);
imageInputLayer([1 3 1], 'Normalization', 'none');
convolution2dLayer([1 200],20,'stride',1);
maxPooling2dLayer([1 20],'stride',10);
maxEpochs = 100;
miniBatchSize = 100;
options = trainingOptions('adam', ...
'ExecutionEnvironment','auto', ...
'MaxEpochs',maxEpochs, ...
'MiniBatchSize',miniBatchSize, ...
'GradientThreshold',1, ...
'Verbose',false, ...
net = trainNetwork(trainD',targetD,layers,options);
I have a data array for training with 7034 rows and 3 column ( input) and 4th column as output (catagorial). My code is attached. I am receiving the following error:
Eror using trainNetwork (line 170)
Invalid network.
Caused by:
Layer 2: Input size mismatch. Size of input to this layer is different from the expected input size.
Inputs to this layer:
from layer 1 (output size 1×3×1)
Can anyone tell me what is the problem with the input layer. As I have given my input layar like
imageInputLayer([1 3 1]);
I have created a 4D data array using reshape. trainDNew = reshape(trainD', [1,3,1,7034]);
Please help me with this problem.


Sign in to comment.

Answers (0)