How to disable logs of LibSVM weka library in java? -
i using libsvm library on weka 3.6 , experiencing similar problem in here (for java) , here (for python)
the libsvm library generates lot of logs simliar this
optimization finished, #iter = 399 nu = 0.9503376170384973 obj = -124.54791151883072, rho = 0.0528133707297996 nsv = 257, nbsv = 97 i followed solution using -q parameters setting parameter in code:
libsvm svm = new libsvm(); string[] options = {"-q"}; svm.setoptions(options); although solution seems work in python doesn't work in java code.
another solution suggests using log4j , disable level of logs, however, don't want add library code.
now, i'm wondering there clean , simple solution disable libsvm logs?
libsvm library weka fqn of "weka.classifiers.functions.libsvm" wrapper around svm algorithm create common interface java programmers using weka api.
inside "libsvm.jar" there jar file named "libsvm.jar" main algorithm. contrary libsvm use common java naming conventions, naming convention inside "libsvm.jar" different. inside "libsvm" package there class named "svm". because had used "svm" variable name, "svm" class invisible.
after knowing that, followed instruction in here , changed "svm" "libsvm.svm" , code working me. in addition, put code in static block of code have usages.
static{ libsvm.svm.svm_set_print_string_function(new libsvm.svm_print_interface() { @override public void print(string s) { } // disables svm output }); } finally, using libsvm without annoying logs.
Comments
Post a Comment