Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
251 views
in Technique[技术] by (71.8m points)

matlab - LIBSVM : Same Labels for all tests?

I have 500 feature vectors and everyone is labelled in range 1-6 for 6 classes. I'm storing them in a mat file which looks like:

m=load('TrainingData')
m = 
         Labels: [1x500 double] % labels for each class in 1-6
           Data: [500x20 double] % Vectors

According to some post on forum, I passed vectors in sparse format

TrData=sparse(m.Data);

Then I have passed this data to train svm using LIBSVM :

svm_model=svmtrain(Labels,TrData,'-c 1 -g 0.2 -b 1');

The generated model look like:

svm_model = 
    Parameters: [5x1 double]
      nr_class: 6
       totalSV: 500
           rho: [18x1 double]
         Label: [6x1 double]
    sv_indices: [500x1 double]
         ProbA: [18x1 double]
         ProbB: [18x1 double]
           nSV: [6x1 double]
       sv_coef: [500x5 double]
           SVs: [500x20 double]

Now I'm calculating feature vectors for 128 test files with labels

Test = 
        TLabels: [1x127 double]
          TData: [127x20 double]

Where, labels of test data are unknown, simply used any random double values (as per readme file) . And then passing it to testing phase viz.

testin=sparse(Test.TData);
[lbl,accu,prob] = svmpredict(TLabels, testin, svm_model, '-b 1');

and the doubtful part is all 127 vectors have prob as :

prob =
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.0000        0.0000    0.0000    0.0000    0.0000    1.0000
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427
    0.1427        0.1427    0.1428    0.1436    0.1429    0.1427

With all labels 3 except one having all 0's as 6. And

Accuracy = 0.787402% (1/127) (classification)

Why is it so...?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...