help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

kclassify problem


From: Carlo Rossi
Subject: kclassify problem
Date: Fri, 22 May 2009 18:05:27 +0000 (GMT)

Hello,
 I post it here even it's for matlab but maybe it could be interesting as well.
 I have to use kclassufy to classify a test set of 10 digits (0..9);
then I have 10 differents classes. And I have a very large training
and test set.
I tried to do it with that seems classify in the right way but it
takes more than 10 minutes. Is there any mistake or it's simply wrong
this way?

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%I fill TRAIN and TEST with only '1' to fill they quickly but it's not real....

TRAIN = [ repmat(1, 50000, 500) ];
TEST = [ repmat(1, 400, 500) ];
only '1' in the test set...
size_tr = size(TRAIN,1);
size_te = size(TEST,1);
group = [repmat(0, size_tr/10,1); repmat(1, size_tr/10,1); repmat(2,
size_tr/10,1); repmat(3, size_tr/10,1);
    repmat(4, size_tr/10,1); repmat(5, size_tr/10,1); repmat(6,
size_tr/10,1); repmat(7, size_tr/10,1);
    repmat(8, size_tr/10,1); repmat(9, size_tr/10,1); ]';

target= [repmat(0, size_te/10, 1); repmat(1, size_te/10, 1) ; repmat
(2, size_te/10, 1);
  repmat(3, size_te/10, 1); repmat(4, size_te/10, 1); repmat(5,
size_te/10, 1); repmat(6, size_te/10, 1);
  repmat(7, size_te/10, 1); repmat(8, size_te/10, 1); repmat(9,
size_te/10, 1) ]';

Kclassification = knnclassify(TEST, TRAIN, group, 1, 'euclidean',
'random');
[c order] = confusionmat( target, Kclassification)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


Unfortunately I have a larger test set.......
Any suggestion to improve it? Actually I'm looking for another way to
do it... 


thanks,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]