Borrar filtros
Borrar filtros

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

4 visualizaciones (últimos 30 días)
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);

Respuesta aceptada

Walter Roberson
Walter Roberson el 31 de Jul. de 2020
Editada: Walter Roberson el 4 de Ag. de 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 comentarios
zain yousaf
zain yousaf el 12 de Ag. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by