Search code examples
matlablibsvmverbose

Matlab libsvm svmpredict accuracy verbose


I have a question of an annoying fact. I'm using libsvm with matlab and I'am able to predict using:

predicted_label = svmpredict(Ylabel, Xlabel, model);

but it happen that every time I make a predictions appears this:

Accuracy = X% (y/n) (classification)

Which I find annoying because I am repeating this procedure a lot of times and also makes it slow because its displaying in screen.

I think what I want is to avoid that svmpredict being verbose.

Can anyone help me with this? Thanks in advance.

-Jessica


Solution

  • If you are using matlab, just find the line of code that is displaying this information (usually using 'disp', 'sprintf', or 'fprintf') and comment it out using the commenting operator %.

    example:

    disp(['Accuracy= ' num2str(x)]);
    

    change it to:

    % disp(['Accuracy= ' num2str(x)]);
    

    If you are using the main libsvm library then you need to modify it before making. 1- Open the file 'svmpredict.c'

    2- find this line of code:

    info("Accuracy = %g%% (%d/%d) (classification)\n",
    (double)correct/total*100,correct,total);
    

    3- just comment it out using // operator

    4- save and close the file

    5- make the project