How to make matrix a possitive definite
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Micha? Kowalczyk
el 24 de Ag. de 2011
Respondida: Fadi Alsuhimat
el 6 de Jul. de 2020
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.
Thank you in advance!
Michael
0 comentarios
Respuesta aceptada
Arturo Moncada-Torres
el 24 de Ag. de 2011
I understand that you may need as few training samples as possible. However, this is not always good, since your performance will not be so good (obviously).
If you really need to do so, I recommend you to use MATLAB's CVPARTITION. Choose 'holdout' method and try with different proportions until you find the minimum one. For example:
% 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
0 comentarios
Más respuestas (2)
Ilya
el 25 de Ag. de 2011
If you have 10935 predictors, your entire training and test data are not going to be enough to make the covariance matrix non-singular. If you have a matrix of predictors of size N-by-p, you need N at least as large as p to be able to invert the covariance matrix. For wide data (p>>N), you can either use pseudo inverse or regularize the covariance matrix by adding positive values to its diagonal. Neither is available from CLASSIFY function.
In 11b release, you could use ClassificationDiscriminant.fit with 'pseudoLinear' or 'pseudoQuadratic' option.
-Ilya
0 comentarios
Fadi Alsuhimat
el 6 de Jul. de 2020
Just write it like this
augmentedTrainset=augmentedImageDatastore(imagesize,...
trainset,'ColorPreprocessing','gray2rgb');
%%% this mean you add another type for lda by using 'ColorPreprocessing','gray2rgb'
0 comentarios
Ver también
Categorías
Más información sobre Classification Ensembles en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!