Xtra-Computing / thundersvm

ThunderSVM: A Fast SVM Library on GPUs and CPUs
Apache License 2.0
1.57k stars 218 forks source link

Return 0-1 value for classification? #216

Closed antithing closed 4 years ago

antithing commented 4 years ago

Hi, I am looking for a way to classify intensity of facial expressions by passing normalized landmark points into an SVM.

Using this code, can I then return the intensity, or zero to one value of each class?

Thanks!

zeyiwen commented 4 years ago

Please try the -b option in parameter page.

Otherwise, you need to obtain the raw values of ThunderSVM in the C++ code, before the conversion into labels. You are more than welcome to contribute a new interface to this project.

antithing commented 4 years ago

Hi @zeyiwen , I have my data prepared and scaled to 0 - 1. I am training a model using:

thundersvm-train -s 1 -c 100 -b 1 -g 0.5 data.csv

This trains well, and when i predict with:

thundersvm-predict data.csv data.csv.model data.csv.predict

I get a file with the labels and probabilities.


2020-05-10 18:46:00,719 INFO [default] loading dataset from file "data.csv"
2020-05-10 18:46:00,727 INFO [default] #instances = 57, #features = 36
2020-05-10 18:46:00,980 INFO [default] predict with probability
2020-05-10 18:46:00,992 INFO [default] Accuracy = 0.947368

labels 0 1 2 
0 0.874525 0.0890417 0.0364336 
0 0.982203 0.00396966 0.0138274 
0 0.835266 0.0798462 0.0848874 
0 0.844447 0.115121 0.040432 
.... etc

Great! My question is, what can i adjust to increase the accuracy? Is it possible to get up to 99% or more? Or is this probably down to my data?

Should I scale to 0 to 1? or is -1 to 1 better?

Thank you again for your amazing work!

zeyiwen commented 4 years ago

These are some general questions on hyperparameter tuning and data preprocessing. Let's keep the forum for ThunderSVM related discussions.