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

5 次查看(过去 30 天)
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);

采纳的回答

Walter Roberson
Walter Roberson 2020-7-31
编辑:Walter Roberson 2020-8-4
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 个评论
zain yousaf
zain yousaf 2020-8-12
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by