Getting error using Linear Discriminant Analysis(LDA) in MATLAB.

I am trying to classify training and testing data using LDA classify in MATLAB R2018b and getting error.
Error : Error using classify
TRAINING must have more observations than the number of groups.
I have following matrics for training and testing.
feature_training= 1440 x 9
class_training= 1440 x 1
feature_testing= 1152 x 9
class_testing= 1152 x 1
Note: I already have more Training Elements than Testing Elements.
[error_training,error_testing,classification_training,classification_testing]...
= ldaclassify(feature_training,feature_testing,class_training,class_testing);
Where ldaclassify, is below function.
function [TrainErr,TestErr,TrainPredict,TestPredict] = ldaclassify(TrainData,TestData,TrainClass,TestClass)
TrainPredict = classify(TrainData,TrainData,TrainClass);
TestPredict = classify(TestData,TrainData,TrainClass);
TrainErr = sum(TrainPredict ~= TrainClass)/length(TrainClass)*100;
TestErr = sum(TestPredict ~= TestClass)/length(TestClass)*100;
end

2 件のコメント

the cyclist
the cyclist 2019 年 6 月 29 日
Can you upload the data in a MAT file, so that we can actually run your code?
Hassan Ashraf
Hassan Ashraf 2019 年 6 月 29 日
Here are the files, I am using for classification

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

質問済み:

2019 年 6 月 29 日

コメント済み:

2019 年 6 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by