Data format for classification Learner App for time sequence to class prediction

14 次查看(过去 30 天)
I want to use Classification Learner App for dataset with 400 observations divided into 4 folders: A,B,C,D (100 each).
Folder Names are as per their category/ class: A,B,C,D.
Each observation is stored in CSV file as Var 1,....Var 10 (as col) for 20 time steps (as row).
Is it possible to import these data in Classification Learner App in some way?

回答(1 个)

Binaya
Binaya 2024-1-14
Hi Subhadip
I understand that you want to load your dataset into MATLAB's Classification Learner app.
To load the dataset into Classification Learner app, please follow the below steps:
  1. Read the all CSV files into MATLAB workspace using "readtable" function.
  2. Concatenate all the tables into one using "vertcat".
  3. In Classification Learner app, select the final combined table as the input.
  4. The data from the table should now be loaded into the Classification Learner app.
Please refer to the below documentation for more details:
  1. "classificationLearner": https://www.mathworks.com/help/stats/classificationlearner-app.html
  2. "readtable": https://www.mathworks.com/help/matlab/ref/readtable.html
  3. "vertcat": https://www.mathworks.com/help/matlab/ref/double.vertcat.html
I hope this helps.
Regards
Binaya
  1 个评论
Subhadip
Subhadip 2024-1-17
编辑:Subhadip 2024-1-17
Thanks Binaya. I kept all csv in one folder and stored in DataTable datastore, I could have kept the files in separate folder as per the category and store it in sepratae Datastore and then combine them with "vertcat". However both provide the same result. I also have obs_class of same size as DataTable and then combined them in Final_DataTable.
fds = fileDatastore("my path","ReadFcn",@readtable,"FileExtensions",'.csv')
DataTable = readall(fds);
Final_DataTable=table(DataTable, obs_class, 'VariableNames', {'Data', 'Class'});
But the classification learner still did not pick up the predictor sequence from each cell in the table. It took the response from categorical array. Attached the snapshot. I could not find example for Classification Learners with each entry of variable as sequence.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by