The pooled covariance matrix of TRAINING must be positive definite.

13 ビュー (過去 30 日間)
sun rise
sun rise 2022 年 1 月 21 日
コメント済み: sun rise 2022 年 1 月 29 日
clc
clear all
load featurs_T
load featurs_S
load Group_Train
load Group_Test
cv_x=cov(Feat1);
[V,D] = eig(cv_x);
d=diag(D);
d=d(end:-1:1);
sm_d=cumsum(d) /sum(d);
idx=find(sm_d>0.99);
T=[V(:,end:-1:idx(1))]';
new_feat1=T*Feat1';
%TrainingSet= new_feat1';
new_feat2=T*Feat2';
%TestSet= new_feat2';
TrainingSet = new_feat1';
TestSet = new_feat2';
Group_Train1 = Group_Train1';
Group_Test1 = Group_Test1';
%------------------------
% result1= multisvm(TrainingSet,Group_Train1,TestSet,Group_Test1);
result1= classify(TestSet,TrainingSet,Group_Train1,'linear');
testresult = result1;
Accuracy = mean(Group_Test1==result) * 100;
fprintf('Accuracy = %.2f\n', Accuracy);
fprintf('error rate = %.2f\n ', mean(result ~= Group_Test1 ) * 100);
Error using classify (line 233)
The pooled covariance matrix of TRAINING must be positive definite.
Error in HOG2 (line 31)
result1= classify(TestSet,TrainingSet,Group_Train1,'linear');
  5 件のコメント
sun rise
sun rise 2022 年 1 月 24 日
I actually used pca to reduce dimensions. But the error is still there
sun rise
sun rise 2022 年 1 月 29 日
Feat1 = pca(Feat1);
Feat2 = pca (Feat2);
But why is pca decreasing the number of images and thus I get this error
The length of GROUP must equal the number of rows in TRAINING.
This is evident in the workspace

サインインしてコメントする。

採用された回答

Matt J
Matt J 2022 年 1 月 23 日
I suggest you calculate the pooled covariance matrix and verify whether the error message is accurate.

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by