How to do Leave-One-Subject-Out in Matlab?

20 views (last 30 days)
MA-Winlab
MA-Winlab on 14 Oct 2019
Answered: Shishir Singhal on 29 Jul 2020
Hi, guys
I would like to use Leave-One-Subject-Out for classiffication purposes. In my case, I have a dataset from 16 subjects, containing acceleration traces.
I would like to use binary SVM to see the classification accuracy with unseen subject. Thus I would like to train the SVM on the data from 15 users and test on the one left. I was able to split the data based on this, but in this case if I train on the data of the 15 users, the SVM does not know the label of the 16th one ! so it would not report the positive label (of the 16 th user) and rather than that it will find the closest label, which is the one of the 15 users (as all of them have same label in binary SVM).
Your help is appreciate
Thank you

Answers (1)

Shishir Singhal
Shishir Singhal on 29 Jul 2020
Hi,
Please refer to the documentation to implement "Leave one out cross validation": https://in.mathworks.com/help/stats/cvpartition.html#d120e209754
If all the data points have same label in train set, then it is highly likely that it would predict the same label for any test point. It is because your SVM thought that all the data points are belongs to the same distribution.
To solve this problem, it would recommend to increase the data size with some good ratio of positive and negative samples.
Thanks,

Categories

Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!