How to improve LSTM algorithm to extract features of time derivative signal, GPU, deep learning

5 visualizzazioni (ultimi 30 giorni)
Hi I am working on deep learning tool to desing a technique to classify fault type, im facing difficulty in preparing data type and I dont know why please have a look at my code and advice.
%unamed is 170*244 double type matrix
Daten = unnamed;
[m,n] = size(Daten) ;
%Split into train and test
P = 0.7;
Training = Daten(1:round(P*m),:) ;
Testing = Daten(round(P*m)+1:end,:);
%XTrain is 119*243 double type matrix
XTrain = Training(:,1:n-1);
%YTrain is 119*1 double type matrix
YTrain = Training(:,n);
%XTest is 51*243 double type matrix
XTest = Testing(:,1:n-1);
%YTest is 51*1 double type matrix
YTest = Testing(:,n);
layers = [ ...
sequenceInputLayer(119)
lstmLayer(100,"OutputMode","sequence")
dropoutLayer(0.1)
lstmLayer(100,"OutputMode","last")
fullyConnectedLayer(1)
softmaxLayer
classificationLayer];
options = trainingOptions("adam", ...
"MaxEpochs",150, ...
"MiniBatchSize",miniBatchSize, ...
"Plots","training-progress", ...
"Verbose",false, ...
"Shuffle","every-epoch", ...
"LearnRateSchedule","piecewise", ...
"LearnRateDropFactor",0.1, ...
"LearnRateDropPeriod",20,...
'ValidationData',{XTest,categorical(YTest)});
net = trainNetwork( XTrain , categorical(YTrain) , layers , options);

Risposta accettata

Walter Roberson
Walter Roberson il 31 Lug 2020
Modificato: Walter Roberson il 4 Ago 2020
You are splitting up your data by rows, implying that each row is a sample and that the number of features is the one fewer than the number of columns, with the last column being the class.
That is fine as far as it goes, but when you train, the features must go down columns, not across rows.
sequenceInputLayer(119)
That says that you have 119 features, but you do not: you have extracted 119 samples.
You need to transpose, like
XTest = Testing(:,1:n-1) .';
and you need to use
sequenceInputLayer(NumberOfFeatures)
Now, when you use sequenceInputLayer, what you have to pass in as training data is a cell array. The number of entries in the cell array must match the number of entries in the targets you pass in. Each individual cell entry must be an array in which the number of rows is the same as the number of features, and the number of columns is the same as the number of time steps for the sequence -- so each row corresponds to all the time steps for one particular feature.
It is not clear to me that you really do have sequence data.
  14 Commenti
zain yousaf
zain yousaf il 12 Ago 2020
but sir how i can use my data set along CNN, all CNN examples are for image classification, it gives the impression that CNN is only for image, there is no example availible that shows us that it possbile to use it for my work, any help regarding that will be very useful sir.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Image Data Workflows in Help Center e File Exchange

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by