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

6 vues (au cours des 30 derniers jours)
Subhadip
Subhadip le 14 Jan 2024
Modifié(e) : Subhadip le 17 Jan 2024
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?

Réponses (1)

Binaya
Binaya le 14 Jan 2024
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 commentaire
Subhadip
Subhadip le 17 Jan 2024
Modifié(e) : Subhadip le 17 Jan 2024
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.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by