How can I load 2 features XTrain and YTrain to SequenceInputyer in Deep learning toolbox?
조회 수: 7 (최근 30일)
이전 댓글 표시
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1037210/image.png)
If so, Deep Network Designer can't idenfy the dataset as XTrain and YTrain during training.
댓글 수: 0
답변 (1개)
Ben
2022년 6월 20일
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);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!