Clear Filters
Clear Filters

Related to Classification Learner App

4 views (last 30 days)
Hello all, I am working on SVM classification. I had written the MATLAB code to train the SVM classifier using the line "Mdl_SVM = fitcsvm(feat_training,label_train);". Further, I am test the model using the line "Predic_label_SVM = predict(Mdl_SVM,feat_testing)" and plotted the desired result.
Also, I am trying to perform the same task using Classification learner app. However, my query is that I am getting different results using the two approach i.e., one with using "fitcsvm, predict" and classification learner app.
Any help in this regard will be highly appreciated.

Accepted Answer

Drew
Drew on 6 Feb 2024
Without seeing more details, there are many possible reasons for the difference between your CLI results and the Classification Learner results. Here are some ideas:
(1) Are you using the same datasets for both? If you are only using a training set and a test set at the CLI, without cross-validation, then you should be sure to look at the test set accuracy within the Classification Learner app. To do that, load the training data into the classification Learner app, start the session with your choice of hold-out validation or cross-validation, then train your model, then load the test data, then look at the results on the test data (not the validation results).
(2) Are the fitcsvm training parameters the same at the CLI and in Classification Learner? Prior to model training, check the parameters within Classification Learner using the model summary tab.
For more detailed guidance, attached your data (or a subset thereof) and your corresponding results.
If this answer helps you, please remember to accept the answer.
  2 Comments
chaaru datta
chaaru datta on 6 Feb 2024
Thank u sir for ur detailed response....
the cyclist
the cyclist on 6 Feb 2024
In addition to the above, note that fitcsvm is an algorthm that has inherent randomness built in, so that could be the only reason for the difference. Even calling fitcsvm two times from the command window could lead to different results. (How different the results are will depend on many factors, including the sample size.)
To get reproducible results in the command window, you can see the random number generator seed using
rng default
before the call to fitcsvm.
I'm not sure if/how you can do the same thing for the Classification Learner.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!