How to use Sequence to Sequence Classification in MATLAB using tabular data?

10 views (last 30 days)
I am referring to https://uk.mathworks.com/help/deeplearning/examples/sequence-to-sequence-classification-using-deep-learning.html , which has a detailed example on Sequence to Sequence Classification, for accelerometer data. However, I am trying to do the Seqeunce to Sequence Classification in a different context, for my own problem. I have an input data with 1973 features I would like to use, and the targets are basically sentences. So, using the input predictors, I would like to predict the sentences. My input data is basically a time series, generally at 10 minutes intervals.
So, initially, my Input data was of dimension 21392 x 1976 table, which I have seperated into train and test data. However, the problem is that I am unable to proceed further with the procedure of plotting and visualising the sequence data and training the LSTM network as per this example, because unlike the cell arrays used for Human Activity recognition in the example, my data is of a completely different format, just like a typical structured tabular data, with 21392 rows, each after generally 10 minutes interval, and I have utilised some example syntax at the moment to try to utilise the same for my problem. However, the main confusing part for me is that in my case, why do I need to use a cell array at all? But, if I am not using a Cell array, the LSTM Training is not successfull as it demands the training data to be a cell array. I would appreciate any help or suggestions in this regard. The code I am using (with some modifications I tried) is given below. Cheers!
XTrain = all_data_withdescription(:,1:1973); %These are the features from my input data I would like to use
XTrain = table2cell(XTrain); % Converting the input training data to a cell array to replicate the example
XTrain = XTrain'; % At this point XTrain becomes 1973x21392 cell
YTrain = all_data_withdescription(:,1976); % The 1976th column contains sentences which I would be using as targets
YTrain = table2cell(YTrain);
YTrain = YTrain'; % At this point, YTrain is 1x21392 cell
classes = categories(YTrain{1}); % At this point, I can see that classes is 136x1 cell
X = XTrain(542,:);
X = cell2mat(X); %At this point X is 1x21392 double
figure
for j = 1:numel(classes)
label = classes(j);
idx = find(YTrain{1:21392} == label);
hold on
plot(idx,X(idx))
end
hold off
xlabel("Time Step")
ylabel("Feature 1")
title("Training Sequence 1, Feature 1")
% % legend(classes,'Location','northwest')

Answers (0)

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!