Can I change the SVM classifier output from 'true', 'false' to 0,1?

Hi Can I change the SVM classifier output from 'true', 'false' to 0,1? as i am currently get the output in the form of true and false and it is better for my problem domain to have it in 0 and 1. i write a code to string compare but it takes too long as i have a great amount of data. so if there is anyway to change the output of the classifier to give 0 for the 'false' classifications and 1 for 'true' ones. thank you for your time regards Emad

Respuestas (2)

Add 0 to your output.
true + 0
is 1, and
false + 0
is 0
Or, for many purposes, you can just go ahead and use the logical values in numeric statements.
true * 5 / (false + 1)
Not everything, though: for example, exp(false) will not work, but exp(false+0) will work.
You can cast it to double, try this:
x = [true false true true];
y = double(x);
>> whos
Name Size Bytes Class Attributes
x 1x4 4 logical
y 1x4 32 double

Categorías

Etiquetas

Preguntada:

el 22 de En. de 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by