Train SVM through classification Learner

2 visualizzazioni (ultimi 30 giorni)
Hey Everyone ! My question is about passing variables (training dataset ,Labels and test variable) as predictors and responses. What I do is that pass load all 3 in workspace of matlab and start session. But everytime I get the error(Described in attached Image) i.e No responses selected ,select response variable.My dataset is as following: faces [ size : 5000 * 10000 (5000 samples ,10000 features)] TrainingLabels [ size :5000 *1] TestVariable [ 1*10000] Now what should be Predictors and responses in my case ?
Any Kind help regarding this matter will be highly appreciated. Thankyou.

Risposta accettata

Luuk van Oosten
Luuk van Oosten il 26 Set 2016
Dear Tahira Batool,
The classificationLearner app is not able to import multiple variables from the workspace and work with that. Instead, It requires a table-like format, where you have all your predictors of all samples and the known response. If you look at some of the examples provide by MATLAB, you will see that they load the FisherIris data as a table;
fishertable = readtable('fisheriris.csv');
Now the variable 'fishertable' pops up in the workspace. If you inspect it, you will see that the this table contains all samples (every row is a sample; 150) with their 4 features (column 1-2-3-4) and their known response value for each sample (column 5; species). This table you can import into the classificationLearner app.
MATLAB usually does a great job at automatically identifying the response value (in this case 'Species'). If it fails or does not recognize any response value, you can select it automatically. You can for example also choose to NOT import a feature (such as 'SepalWidth'). This is not really relevant in your case since you have a lot of features.
Then you can choose either crossfold or holdout validation and give it a go.
In your case, you need to put your data in a table with a similar format: samples in rows, features in columns with corresponding response (e.g. class....).
Now you have included something (your 'TestVariable') that requires a slightly different approach, but you could try something similar to the following:
The faces (5000 faces with 10000 features) and the known response class called TrainingLabels (5000, cause you have 5000 faces to classify).
Put them in a table with something similar like:
yourTable = array2table(faces)
yourTable.response = TrainingLabels
And load this table in the classificationLearner app. MATLAB will probably recognize the TrainingLabels appropriately as response.
Play around with the classificationLearner app, and in the end you can export your desired model to the workspace (there is a button for this, top right). Then you can predict your one sample 'TestVariable' and see to which class of 'faces' it belongs to according to your classifier.
  2 Commenti
Tahira Batool
Tahira Batool il 26 Set 2016
Thank you So So very much for such courteous response to my query and literally you have explained it so beautifully ! I have not tried what you have suggested yet but yes, at least I got the Idea (As mentioned ) how to play around with this app and get my problem solved , and that is why I'm accepting this as "accepted answer" . Thanks again Sir .

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by