angleto / liblinear

BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

liblinear gives very different regression results compared with libsvm #20

Open simsong opened 6 years ago

simsong commented 6 years ago

From @CooledCoffee on March 18, 2015 3:32

Procedures

  1. Using the simple regression dataset provided by libsvm http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/regression.html#eunite2001.
  2. Train & predict using both libsvm & liblinear

svm-train -s 3 -t 0 -c 1 -p 0.1 -e 0.001 -h 0 eunite2001 model.1 && svm-predict eunite2001.t model.1 prediction.1

liblinear-train -s 11 -c 1 -p 0.1 -e 0.001 eunite2001 model.11 && liblinear-predict eunite2001.t model.11 prediction.11

liblinear-train -s 12 -c 1 -p 0.1 -e 0.001 eunite2001 model.12 && liblinear-predict eunite2001.t model.12 prediction.12

liblinear-train -s 13 -c 1 -p 0.1 -e 0.001 eunite2001 model.13 && liblinear-predict eunite2001.t model.13 prediction.13

  1. The results are here:
libsvm liblinear -s 11 liblinear -s 12 liblinear -s 13
754.219 711.818 714.293 655.209
735.951 695.675 703.196 651.262
745.716 606.048 601.496 628.192
756.885 721.134 721.481 652.914
758.048 704.657 705.966 644.363
758.296 703.099 703.878 644.147
756.88 680.706 688.226 629.164
753.174 681.003 682.531 631.114
733.147 666.063 668.37 617.042
743.909 606.234 599.665 605.601
... ... ... ...

Questions

  1. To my understanding, "liblinear-train -s 13" is the best match for "svm-train -s 3 -t 0". Is that correct?
  2. Why are the results so different? In general, which tool gives better result?

Copied from original issue: cjlin1/liblinear#10

simsong commented 6 years ago

From @cjlin1 on March 18, 2015 13:28

-s 11 and -s 12 should give you same (or almost the same) results if you use a smaller -e. Regarding libsvm and liblinear their formulations are slightly different. In liblinear by default there is no bias term. Also for libsvm you want to make sure you are using linear kernel for this comparison CooledCoffee writes:

Procedures

  1. Using the simple regression dataset provided by libsvm http:// www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/regression.html# eunite2001.
  2. Train & predict using both libsvm & liblinear

svm-train -s 3 -t 0 -c 1 -p 0.1 -e 0.001 -h 0 eunite2001 model.1 && svm-predict eunite2001.t model.1 prediction.1

liblinear-train -s 11 -c 1 -p 0.1 -e 0.001 eunite2001 model.11 && liblinear-predict eunite2001.t model.11 prediction.11

liblinear-train -s 12 -c 1 -p 0.1 -e 0.001 eunite2001 model.12 && liblinear-predict eunite2001.t model.12 prediction.12

liblinear-train -s 13 -c 1 -p 0.1 -e 0.001 eunite2001 model.13 && liblinear-predict eunite2001.t model.13 prediction.13

  1. The results are here:

libsvm liblinear -s 11 liblinear -s 12 liblinear -s 13 754.219 711.818 714.293 655.209
735.951 695.675 703.196 651.262
745.716 606.048 601.496 628.192
756.885 721.134 721.481 652.914
758.048 704.657 705.966 644.363
758.296 703.099 703.878 644.147
756.88 680.706 688.226 629.164
753.174 681.003 682.531 631.114
733.147 666.063 668.37 617.042
743.909 606.234 599.665 605.601
... ... ... ...

Questions

  1. To my understanding, "liblinear-train -s 13" is the best match for "svm-train -s 3 -t 0". Is that correct?
  2. Why are the results so different? In general, which tool gives better result?

— Reply to this email directly or view it on GitHub.*