input sequence for lstm network

3 ビュー (過去 30 日間)
Philip Hua
Philip Hua 2022 年 6 月 3 日
回答済み: Philip Hua 2022 年 6 月 5 日
hi - i am sorry for asking many questions on LSTM but i find the implementation very confusing in matlab. I have a 32x305296 array of doubles which is generated by embedding musical note tokens in 32 dimensions. Effectively, we have 305296 notes of dimension 32 each in a time sequence. I need to create a LSTM network to train and predict the next note. (so it's a classification problem rather than regression as the token must be one of the permissible notes). I have set up the NN below. When i run the code I get this error
"Invalid training data. For image, sequence-to-label, and feature classification tasks, responses must be categorical."
Bearing in mind that this is a time sequence of embedded notes and not a group of labels, how do i change the time series of tokens to a permissible type?
layers = BachBotNN(32,32,0.3);
function [layers]=BachBotNN(inputSize,numHiddenUnits,dropoutProb)
layers = [ ...
sequenceInputLayer(inputSize)
lstmLayer(numHiddenUnits,'OutputMode','sequence')
batchNormalizationLayer
dropoutLayer(dropoutProb)
lstmLayer(numHiddenUnits,'OutputMode','sequence')
batchNormalizationLayer
dropoutLayer(dropoutProb)
lstmLayer(numHiddenUnits,'OutputMode','last')
batchNormalizationLayer
dropoutLayer(dropoutProb)
fullyConnectedLayer(1)
softmaxLayer
classificationLayer
]
  1 件のコメント
Philip Hua
Philip Hua 2022 年 6 月 5 日
Don't worry about this. I have managed to figure it out using an example online. Thank you

サインインしてコメントする。

採用された回答

Philip Hua
Philip Hua 2022 年 6 月 5 日
there is an example of how to do this in scripttunegenerator.mlx. The whole process is not intuitive so it does take a lot of time to figure out something trivial.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSequence and Numeric Feature Data Workflows についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by