Question

I want classify my data with LDA (Linear discriminant analysis) classifier. My test data size is:

1    12   240    64

And my train data size is:

85    12   240    64  

My label size is:

1 85  

For this purpose I used classify MATLAB code like this:

class = classify(Test_data, Train_data, label, 'linear');

But it give me error:

The length of GROUP must equal the number of rows in TRAINING.

I don't know why give me this error because as you see, my TRAINING data row number is 85, the same as my label(GROUP) length. Can some one please tell me what I have done wrong?

Was it helpful?

Solution

LDA works on rows; note the documentation "training and group must have the same number of rows".

Your labels are currently specified in columns. The following will fix your error:

class = classify(Test_data,Train_data,label','linear');

Note the ' after label to transpose into rows.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top