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

5 vues (au cours des 30 derniers jours)
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
adsXTrain=arrayDatastore(XTrain,"ReadSize",2,"OutputType","same");
adsYTrain=arrayDatastore(YTrain,"ReadSize",2,"OutputType","same");
Then, I combine these two datasets by
cdsTrain=combine(adsXTrain,adsYTrain);
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.

Réponses (1)

Ben
Ben le 20 Juin 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 = cds.read % should be a 1x2 cell where each cell contains a 2x1 vector.
% dummy network and training
layers = [featureInputLayer(2)
fullyConnectedLayer(2)
regressionLayer];
opts = trainingOptions("adam");
net = trainNetwork(cds,layers,opts);

Catégories

En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by