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:
how write python script takes in variables
d,cvalues parameters insvm_parameterfunction.svm_parameter('-d dval')gives error:valueerror : invalid literal int() base 10:dvalhow 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
Post a Comment