How can I load 2 features XTrain and YTrain to SequenceInputyer in Deep learning toolbox?

11 views (last 30 days)
I have a two-feature dataset. The type of XTrain is 2x6000 double, while the type of YTrain is also 2x6000 double. I have transform them into arrayDatastore by
Then, I combine these two datasets by
Unfortunately, when I import cdsTrain in Deep Network Designer as Datastore, it shows 2x12000 double not two columns of 2x6000 double
If so, Deep Network Designer can't idenfy the dataset as XTrain and YTrain during training.

Answers (1)

Ben on 20 Jun 2022
Using "OutputType" as "cell" should help this - e.g. you can do the following at the command line:
% Create fake data,
% I am assuming you have 6000 observations of 2 features.
x = randn(2,6000);
% Create arrayDatastore, use cell outputs, and iteration dimension 2.
% Note - no need to set ReadSize,
% trainNetwork and trainingOptions MiniBatchSize option will handle that.
ds = arrayDatastore(x,"OutputType","cell","IterationDimension",2);
% For this example I just duplicate x for the target data.
cds = combine(ds,ds);
testOutput = % should be a 1x2 cell where each cell contains a 2x1 vector.
% dummy network and training
layers = [featureInputLayer(2)
opts = trainingOptions("adam");
net = trainNetwork(cds,layers,opts);


Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!