5
$\begingroup$

I am attempting to train an SVM from a set of features which are both numeric and categorical, for example:

  • Distance X (Numeric)
  • Distance Y (Numeric)
  • Font Size Difference (Numeric)
  • Word 1 Bold (Boolean)
  • Word 2 Bold (Boolean)
  • Word 1 Font Size (Numeric)
  • ...

For mapping the features to a feature array I am treating true as 1 and false as 0 and then normalizing the entire feature array using Z-Scores.

Should I instead encode false as -1 so it has a numerical impact on the generation of the support vectors, with a value of 0 it does not modify the chosen vector (I assume)?

Should boolean features be normalized in the same way as numerics or should they be left with their encoded values?

$\endgroup$
  • 2
    $\begingroup$ You can always try a couple different configurations and see what does best on your held out validation set $\endgroup$ – kbrose Sep 7 '17 at 0:28
  • 1
    $\begingroup$ The value, whether it is -1, 0, 50, -50, does not matter for SVM. Normalization is not needed, unless the underlying SVM estimator uses gradient descent, which is atypical. $\endgroup$ – Ricardo Cruz Sep 7 '17 at 17:49
1
$\begingroup$

Based on the comment by Ricardo Cruz I tried switching the value of false from 0 to -1 and also normalization on and off.

Neither switching the value from 0 to - 1 or normalization of features had any impact on the values predicted by the SVM. In this case I was using a Gaussian kernel and Sequential Minimal Optimization for my SVM.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.