我使用 knnclassify 共识。我尝试使用共识在类标签中查找缺失值。
这是我的代码;
Rb = randperm(120);
Rm = randperm(120);
labeled = labeled(Rb,:);
unlabeled = unlabeled(Rm,:);
cnt = 0;
sonuc = zeros(120,1);
for i=1:120
pred=knnclassify(unlabeled,labeled,labeledClass,10,'correlation','consensus');
if pred>=1
cnt=cnt+1;
sonuc(i)= pred;
end
end
cnt;
这是我的工作空间;
我的工作空间良性和恶性我的班级价值观 http://imgbox.com/EmWvlqnv
代码不是返回错误而是 pred 在所有行中返回 NaN 并返回一个警告;
Warning: Some points in data have small relative standard deviations,
making them effectively constant. Correlation metric may not be appropriate
for these points.
> In pdist2 at 304
In ExhaustiveSearcher.knnsearch at 207
In knnsearch at 142
In knnclassify at 162
In CancerKNNConsensus at 11
我尝试欧几里得、余弦、城市街区和相关性。如何解决这个问题?