Preparing input data for classification using LSTM
조회 수: 16 (최근 30일)
이전 댓글 표시
I am interested in classifying graphs (senquence) data to category labels. I saw that I could use LSTM however, I would like know how the primary sequence data is store for inputing into the LSTM, I also want to know how to attach know labels to each graph for purpose of training.
In this there is a variable / struture called waveform, how was it constructed?
Please assist
댓글 수: 2
Cris LaPierre
2024년 5월 31일
The format is described at the top of the linked example.
You can also find it described at the top of this example: Sequence-to-One Regression Using Deep Learning
채택된 답변
Cris LaPierre
2024년 5월 31일
It is a mat file. This is a way of saving variables in MATLAB to a file (see save). It loads 3 variables to the Workspace
- data - a 1000x1 cell array. Each cell contains an nx3 array of signal data
- freq - 1000x1 array. This is the frequency of the corresponding observation
- labels - a 1000x1 categorical array containg the waveform label for the corresponding observation
You don't need to create a mat file. You just need to organze your data into a numObservations-by-1 cell array of sequences as the input data.
Each sequence (cell of data) is a numTimeSteps-by-numChannels numeric array, where numTimeSteps is the number of time steps of the sequence and numChannels is the number of channels of the sequence.
The label data is a numObservations-by-1 categorical vector.
You do not need to use freq for the example you are using.
댓글 수: 5
Fan
2024년 8월 14일
Hi Cris,
Sorry for jumpping into this answered question, but i do have a similar question thats been bugging me for a while. I think the Waveform example uses a timestep of 1 so that each row in a observation ( or in a cell), is 1 timepoint.
However, if I want to use a timestep of 5 sliding from time0 - timeN using a slideing window of 1, so basically creating another dimenssion within each observation, how should I organize my input data and label vector? Do i simply make each cell a 3d array, like timestep by channel by number of sliding window?
Also, does it matter if I transpose the input from time by channel to channel by time?
Cris LaPierre
2024년 8월 18일
There is no time data in the linked eample. Instead, index is used (1:numel)..You might be able to back out the actual time step size using the freq data if necessary, but it will require some exta work, as the number of periods captured varies across observations.
If you are following the LSTM example, then yes, order matters. You can read more about the input syntax for trainnet here:
As for your question about data format, that can be specified in the InputDataFormats training option. From the linked doc page:
- "The size and shape of the numeric arrays or dlarray objects that represent sequences depend on the type of sequence data and must be consistent with the InputDataFormats training option."
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Data Workflows에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!