How is it possible to separate features and target (both numerical values) in a tabular text datastore for input in Matlab's Deep Network Design module?

1 view (last 30 days)
Hello everyone, I have a dataset contained in a tabular text datastore with 10 features and the target with a total of 500 rows. My restriction is the mandatory use of Matlab's Deep Network Design module. So, as this Matlab module only accepts datastore as input, I needed to know how to separate target from features in this type of structure. There is a very rich documentation when it comes to image datastore, but numeric datastore I didn't find anything useful and I don't know how to do it. Remembering that I cannot make the neural network by code, the restriction is the use of the Matlab module. If anyone can give me this hand, I would be immensely grateful :)

Answers (1)

yanqi liu
yanqi liu on 8 Dec 2021
yes,sir,use Deep Network Design can get model structure and export it to script,may be export and modify it in code
  2 Comments
paulo silva
paulo silva on 8 Dec 2021
Hi Yanqi, thanks again for your help and proactivity. But after many tests and analysis of the structure of a tabular test datastore, I found a way that solves the issue and separates the 10 features from the target:
dsTrain = tabularTextDatastore("datasettrain.csv");
preview(dsTrain)
dsnewTrain = transform(dsTrain, @(x) [cellfun(@transpose, mat2cell(x{:,1:10},ones(1,500)),'UniformOutput',false), mat2cell(x{:,11},ones(1,500))])
preview(dsnewTrain)
dsValid = tabularTextDatastore("datasetvalid.csv");
preview(dsValid)
dsnewValid = transform(dsValid, @(x) [cellfun(@transpose, mat2cell(x{:,1:10},ones(1,250)),'UniformOutput',false), mat2cell(x{:,11},ones(1,250))])
preview(dsnewValid)
dsTest = tabularTextDatastore("datasettest.csv");
preview(dsTest)
dsnewTest = transform(dsTest, @(x) [cellfun(@transpose, mat2cell(x{:,1:10},ones(1,250)),'UniformOutput',false), mat2cell(x{:,11},ones(1,250))])
preview(dsnewTest)
Again, thank you very much for your help and for those who have the same problem as me, this solution solves it simply. :)

Sign in to comment.

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!