Hi Shubham,
I understand that you want to know the way to format variables in dlarray for training an LSTM model for sequence-to-sequence regression.
To format the cell array data for use with dlarray, you initialize a dlarray with the correct size and then loop through each cell in the cell array to populate the dlarray. Please refer to the below code snippet that illustrates the workflow to format data compatible with dlarray:
% Assuming your cell array is named 'trainingData'
nObservations = size(trainingData, 1);
nFeatures = size(trainingData{1}, 1);
nTimeSteps = size(trainingData{1}, 2);
% Initialize a dlarray
dlTrainingData = dlarray(zeros(nFeatures, nTimeSteps, nObservations));
% Convert the cell array to a dlarray
for i = 1:nObservations
dlTrainingData(:,:,i) = dlarray(trainingData{i});
end
The "CT" format is appropriate for modelling sequence data. However, when using the "mse" function, we need to make sure that the model's output and the ground truth are in the correct format.
Hope it helps.
Regards,
Sai Pavan