How to use excel datastore to in a classification problem
3 次查看(过去 30 天)
显示 更早的评论
In have 5 excel spreadsheet, named, material1.xlsx, ...material5.xlsx. Each of these spreadsheet is placed in a folder called Material1 ... Material5.
Each spreadsheet has 200 rows, with each rows having 100 columns. Meaning each spreadsheet has 200 samples, and each sample has 100 measurements against it,
E.g. if I use readtable
T = xlsread('C:\Users\ernes\OneDrive\Documents\MATLAB\Material1\Material1.xlsx');
So sample 170 is
TM = T(170,:);
as an example, the size(TM) = 1 x 100;
Thus in a nutshell, I want to classify these 5 materials. I first want to train a network that can do this classification task, the foldernames are also labels.
How do I do this using spreadsheetdatastores?
I have only trained networks using imageDatastore, for example in the MNIST images, here is how the loading of the images into the datastore is done
path = fullfile(matlabroot,'toolbox','nnet/nndemos/nndatasets/DigitDataset/');
imds = imageDatastore(path,'IncludeSubfolders',true,'LabelSource','foldernames');
0 个评论
采纳的回答
Drew
2024-4-12
As listed in the doc at https://www.mathworks.com/help/matlab/ref/matlab.io.datastore.spreadsheetdatastore.html, the purpose of spreadsheetDatastore is as follows: "Use a spreadsheetDatastore object to manage large collections of spreadsheet files where the collection does not necessarily fit in memory. You can create a spreadsheetDatastore object using the spreadsheetDatastore function, specify its properties, and then import the data using object functions."
Since you have only 5 spreadsheets which are each 200x100 in size, all of the data from all 5 spreadsheets can fit easily in memory. So, you might just want to load all of the data into a single table, and then do classification experiments with the Classification Learner app from the Statistics and Machine Learning Toolbox. Classification Learner includes the ability to train many types of machine learning models, including neural networks. You could also train neural networks using the Deep Learning Toolbox.
Even though your data is small enough to fit in memory, if you still want to use spreadsheetDatastore, the doc page https://www.mathworks.com/help/matlab/ref/matlab.io.datastore.spreadsheetdatastore.html should provide the info that you need.
If this answer helps you, please remember to accept the answer.
5 个评论
Walter Roberson
2024-4-17
@ernest modise comments:
I really this help. I have searched YouTube, I only see meaningful application of image based problems
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!