Machine learning, Neural network with data in array format

Hi,
New to using NN in matlab. I'm looking to classify some data. Each event is contained in a 35x3 array. I have around 10k events so the matrix is 35x3x10000. The predictor is 10000x1 with values 0 or 1. I looked at the documentation and examples, but is not clear to me how I build and feed this data into the NN.
I'm doing this to classify simulation data for a neutron instrument. The events can be single or double scatter. Any help (and patience) will be greatly appreciated.
Rgds,
George

回答 (2 件)

KSSV
KSSV 2022 年 2 月 10 日

0 投票

1 件のコメント

George Suarez
George Suarez 2022 年 2 月 10 日
編集済み: George Suarez 2022 年 2 月 10 日
Thanks. I tried it before posting and didn't work. I'm sure is me no understanding how to configure the CNN.
%trainD is a 35x3x10000 array
trainDtarget = categorical(trainDtarget'); %10000x1 array
layers = [
imageInputLayer([size(trainD,1) size(trainD,2) 1])
convolution2dLayer(8,3,'Padding','same')
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,16,'Padding','same')
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,32,'Padding','same')
batchNormalizationLayer
reluLayer
fullyConnectedLayer(2)
softmaxLayer
classificationLayer];
options = trainingOptions('sgdm', ...
'InitialLearnRate',0.01, ...
'MaxEpochs',4, ...
'Shuffle','every-epoch', ...
'ValidationData',table(trainDtarget), ...
'ValidationFrequency',30, ...
'Verbose',false, ...
'Plots','training-progress');
net = trainNetwork(trainD,trainDtarget,layers,options);
I get an error
Error using trainNetwork (line 184)
Invalid network.
Caused by:
Layer 9: Input size mismatch. Size of input to this layer is different from the expected input size.
Inputs to this layer:
from layer 8 (size 17(S) × 1(S) × 16(C) × 1(B))

サインインしてコメントする。

yanqi liu
yanqi liu 2022 年 2 月 18 日

0 投票

yes,sir,may be upload your data mat file to analysis,or check
make cnn model by the input data dimension

カテゴリ

ヘルプ センター および File ExchangeDeep Learning Toolbox についてさらに検索

質問済み:

2022 年 2 月 10 日

回答済み:

2022 年 2 月 18 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by