Hi Everyone, I have a problem with classification. I have 39 samples of training data (39x10935) and 347 samples of testing data (347x10935). classify function returns: "The covariance matrix of each group in TRAINING must be positive definite" error. Is there any method to compute the minimal size of training set? I know that I could just add some test samples to the training set, but the nature of the problem that I am solving requires as little training samples as possible.
John Williams answered .
2025-11-20
% Assuming you have a vector with the labels in an array called "classes" and your data (features) in a matrix called "myData". for ii = 1:19; testProportion = (ii*5)/100; c = cvpartition(classes, 'holdout',testProportion); trainData = myData(training(c,1),:); testData = myData(test(c,1),:); % Try your classifier here. end