machine learning - Cross validation for polynomial kernel in LibSVM, using Python -


i using libsvm python. prior building classifier, want plot average error of cross validation different values of d , c find best (d, c) combination in terms of average accuracy. wrote python script cross-validate particular d, c value , output each of ten iterations of cross-validation appeared on screen. have 2 problems now:

  1. how write python script takes in variables d , c values parameters in svm_parameter function. svm_parameter('-d dval') gives error:

    valueerror : invalid literal int() base 10:dval 
  2. how record output data - can't find way save accuracy each classification unless manually copy unix screen. there way access , save output file?

thank you. new python.

i recommend use excellent sklearn library task. has wrapper libsvm (see svm.svc), in addition gives necessary tools cross-validation, finding optimal d , c grid-search, easy way measure accuracy metrics module , huge number of other useful tools.

regarding valuerror, python attempts cast string dval integer. want svm_parameter('-d %s' % dval), if dval variable holding value of d.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -