' The length of GROUP must equal the number of rows in TRAINING.',how can i solve this issue...?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
sahana kp
el 20 de Nov. de 2016
Respondida: the cyclist
el 20 de Nov. de 2016
Hi, I am new to the matlab coding.when iam using linear classifier to classify the test and train signal it shows' The length of GROUP must equal the number of rows in TRAINING.',and the code i have used is given below,
a=ones([1060,1]);
b=zeros([1060,1]);
c=cat(1,a,b);
class=classify(test,train,c,'linear');
SVMStruct=svmtrain(train,c);
class=svmclassify(SVMStruct,test,'Showplot',true);
class = knnclassify(test,train,c,1);
and
>>size(test)
ans =
2 6354
size(train)
ans =
2 9540
>> size(c)
ans =
2120 1
how can i solve this problem...?
Any response would be greatly appreciated. Thanks in advance.
0 comentarios
Respuesta aceptada
the cyclist
el 20 de Nov. de 2016
I suggest you carefully read the documentation for classify, and really try to understand what each input represents.
The main conceptual thing to understand is that the third argument, group (your variable c), should have the same number of rows as the second argument, training, (your variable train). The reason is that you are telling classify which group that each row of training belongs to. For example,
training = [1 2;
6 5;
4 4;
1 1];
group = [1;
2;
2;
1];
would be telling MATLAB that the first and last row of training are in group 1, and the other two rows are in group 2.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Classification Ensembles en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!