Formatting Data in dlarray for Machine Learning Input
Hello there I am trying to format my data so that I can input it into my machine learning model. I have input values in XTrain which is a 1×10 cell contatining 3×540 doubles in each cell. This corresponds to the 3 channels, 540 time steps, and the 10 of these are the 10 traials or "batches". When I run the following code below I get 3(C) × 540(B) × 1(T) dlarray which is incorrect. I want to be getting 3(C) × 10(B) × 540(T) dlarray coreespoding to the 3 channels, 10 batches/trails, and 540 time steps. Is there a way in which I can fix this or and suggestions on how I should format my data in XTrain to get the datra in the coreect CBT format? Any help is greatly appreciated!
% Data dimensions
%numFeatures = 3
%numTimeSteps = 541
%numTrials = 10
Xtrain = Predictors;
Ytrain = Output;
% Convert cell arrays to dlarray format
for i = 1:numTrials
XTrain{i} = dlarray(Xtrain{i}, ‘CBT’); % ‘CTB’ stands for ‘Channel’, ‘Time’, ‘Batch’
YTrain{i} = dlarray(Ytrain{i}, ‘TB’); % ‘TB’ stands for ‘Time’, ‘Batch’
endHello there I am trying to format my data so that I can input it into my machine learning model. I have input values in XTrain which is a 1×10 cell contatining 3×540 doubles in each cell. This corresponds to the 3 channels, 540 time steps, and the 10 of these are the 10 traials or "batches". When I run the following code below I get 3(C) × 540(B) × 1(T) dlarray which is incorrect. I want to be getting 3(C) × 10(B) × 540(T) dlarray coreespoding to the 3 channels, 10 batches/trails, and 540 time steps. Is there a way in which I can fix this or and suggestions on how I should format my data in XTrain to get the datra in the coreect CBT format? Any help is greatly appreciated!
% Data dimensions
%numFeatures = 3
%numTimeSteps = 541
%numTrials = 10
Xtrain = Predictors;
Ytrain = Output;
% Convert cell arrays to dlarray format
for i = 1:numTrials
XTrain{i} = dlarray(Xtrain{i}, ‘CBT’); % ‘CTB’ stands for ‘Channel’, ‘Time’, ‘Batch’
YTrain{i} = dlarray(Ytrain{i}, ‘TB’); % ‘TB’ stands for ‘Time’, ‘Batch’
end Hello there I am trying to format my data so that I can input it into my machine learning model. I have input values in XTrain which is a 1×10 cell contatining 3×540 doubles in each cell. This corresponds to the 3 channels, 540 time steps, and the 10 of these are the 10 traials or "batches". When I run the following code below I get 3(C) × 540(B) × 1(T) dlarray which is incorrect. I want to be getting 3(C) × 10(B) × 540(T) dlarray coreespoding to the 3 channels, 10 batches/trails, and 540 time steps. Is there a way in which I can fix this or and suggestions on how I should format my data in XTrain to get the datra in the coreect CBT format? Any help is greatly appreciated!
% Data dimensions
%numFeatures = 3
%numTimeSteps = 541
%numTrials = 10
Xtrain = Predictors;
Ytrain = Output;
% Convert cell arrays to dlarray format
for i = 1:numTrials
XTrain{i} = dlarray(Xtrain{i}, ‘CBT’); % ‘CTB’ stands for ‘Channel’, ‘Time’, ‘Batch’
YTrain{i} = dlarray(Ytrain{i}, ‘TB’); % ‘TB’ stands for ‘Time’, ‘Batch’
end dlarray, data formatting, machine learning MATLAB Answers — New Questions