yctung / AndroidLibSVM

The well-known LibSVM on Android
BSD 3-Clause "New" or "Revised" License
111 stars 43 forks source link

Getting the classification accuracy #4

Closed Zumbalamambo closed 7 years ago

Zumbalamambo commented 7 years ago

How do I get the accuracy percentage of classification?

yctung commented 7 years ago

Hi,

Do you mean the accuracy of prediction? (I think it can be got by just comparing the predict results and your data, right?). If you mean the probability of classification. You can do this:


       // 4. make SVM train
        String svmTrainOptions = " -b 1 -t 2 ";
        jniSvmTrain(svmTrainOptions + dataTrainPath + modelPath);

        // 5. make SVM predict
        String svmPredictOptions = " -b 1 ";
        jniSvmPredict(svmPredictOptions + dataPredictPath + modelPath + outputPath);

Where the -b is the original option in LibSVM to get probability model