LDA analysis: The pooled covariance matrix of TRAINING must be positive definite.

3 ビュー (過去 30 日間)
Hieu Nguyen
Hieu Nguyen 2018 年 10 月 21 日
回答済み: Fadi Alsuhimat 2020 年 7 月 6 日

Hello, I am running into this issue. How can I resolve it?

Y = csvread('mydata.csv');
flag = Y(:,1);
label = Y(:,2);
P = Y(:,3:end);
train = Y((flag < 5) & (label == 8|9),:);
test = Y((flag == 5) & (label == 0),:);
[coeff,score,latent] = pca(train);
group = Y((flag < 5) & (label == 8|9));
class = classify(Y,train,group,'linear');

My research online gives me some hints that I should apply PCA to the training samples and project onto the first 2 principal components. Then, apply LDA to project onto 1 dimension.

How can I take the result of PCA and input it as a parameter in classify()?

Thank you!

回答 (1 件)

Fadi Alsuhimat
Fadi Alsuhimat 2020 年 7 月 6 日
Just write it like this
augmentedTrainset=augmentedImageDatastore(imagesize,...
trainset,'ColorPreprocessing','gray2rgb');
%%% this mean you add another type for lda by using 'ColorPreprocessing','gray2rgb'

カテゴリ

Help Center および File ExchangeDimensionality Reduction and Feature Extraction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by