Is my CNN Correct
3 views (last 30 days)
Show older comments
Is my CNN Correct ( It works in my data but I need to confirm it with expert review)
% CNN Definition
layers = [
sequenceInputLayer(1)
convolution1dLayer(5,16,'Padding','same')
batchNormalizationLayer
reluLayer
convolution1dLayer(3,32,'Padding','same')
batchNormalizationLayer
reluLayer
globalAveragePooling1dLayer
fullyConnectedLayer(16)
reluLayer
fullyConnectedLayer(2)
softmaxLayer
classificationLayer
];
options = trainingOptions('adam', ...
'InitialLearnRate',0.001, ...
'MaxEpochs',30, ...
'MiniBatchSize',128, ...
'Shuffle','every-epoch', ...
'Verbose',false, ...
'ExecutionEnvironment','auto', ...
'Plots','none');
net = trainNetwork(XTrain, categorical(YTrain), layers, options);
0 Comments
Answers (2)
Chuguang Pan
on 26 Jul 2025
layers = [
sequenceInputLayer(1)
convolution1dLayer(5,16,'Padding','same')
batchNormalizationLayer
reluLayer
convolution1dLayer(3,32,'Padding','same')
batchNormalizationLayer
reluLayer
globalAveragePooling1dLayer
fullyConnectedLayer(16)
reluLayer
fullyConnectedLayer(2)
softmaxLayer
]; % classificationLayer is not recommended
cnnNet = dlnetwork(layers);
input = dlarray(rand(1,20,1024),"CBT");
% analyzeNetwork(cnnNet,input) % analyzeNetwork is not supported in online
0 Comments
Walter Roberson
on 26 Jul 2025
There are definitely more than 10 possible layers at any point.
Your system has 12 layers.
Therefore there are over 10^12 possible combinations for 12 layers.
We have no possible way of knowing whether your one network is "the" correct network out of 10^12 possibilities.
The most we could talk about is whether it is a plausible arrangement of layers for some purpose. There is absolutely no way for us to know that it is the one true network... since you did not even describe your needs.
0 Comments
See Also
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!