I am building a Naive Bayes classifier (nb) using sklearn.
The dataset consists of 4 subjects with each a different amount of labeled data.
I want to apply leave-one-subject-out cross validation, but I do not find a comparable example on the internet.
My data consists of the following:
x = [[2,0],[3,1],[2,1],[3,2]], [[4,2],[5,3],[5,2],[5,3]], [[7,3],[6,2],[7,1],[6,2]], [[2,3],[2,4],[3,4],[2,3]]]
y = [[0,1,3,2],[1,2,3,2],[0,1,1,1],[0,1,2,1]]
So the data of each subject is a subarray in x with the corresponding subarray of y. The input features consists of 2 elements each (for example the mean and std of an accelerometer).
I found on the internet the example of
sklearn.model_selection.LeaveOneOut
But this does not work in my example since I want to take data of a whole subject as a test set.
Is there a good equivalent for my needs?