Assume that you are given a vector 0b1101001001011001 etc. And you are going to classify it. One can use Support Vector Machine, but is that method good for classifying data that are spare and binary?

Assume that you are given a real vector $x$ with dimension $N$. The vector contains only ones and zeros. $x = [0, 1, 0, 0, 0, 1, 1]^T$

You are not given one vector $x$, instead you are given a matrix of vectors e.g $X = [x_1, x_2, x_3, \dots , x_M]$ where $N$ is constant but $M$ can vary.

From the matrix $X$, you are also given a vector called labels $y$. The labels are labled either with -1 or +1. The labels $y$ is one vector with the same length as $M$.

So, from the labels $y$ and matrix $X$, you can find weights $W$ and bias $b$ on the form

$$y_i = Wx_i^T + b$$

But is SVM a good way to classify this type data?

  • 1
    $\begingroup$ You need much more information than this to answer the question. $\endgroup$
    – Pål GD
    Oct 26, 2023 at 8:40
  • $\begingroup$ @PålGD done.... $\endgroup$
    – euraad
    Oct 26, 2023 at 10:43

1 Answer 1


If I understand your question correctly, the features in your case are exclusively categorical. Support Vector Machines might work, but they would not be my model of choice for such data. SVMs try to separate the classes by a plane¹ with maximum distance to the closest samples in (transformed) feature space. That distance, however, is pointless with categorical data.

I would suggest that You try Decision Trees which give well-interpretable results. If Decision Trees are not working for you, give Random Decision Forests a try.

¹ In some high-dimensional kernel space.

  • $\begingroup$ Thank you. Hmmm....decision tress might be unstable. $\endgroup$
    – euraad
    Oct 29, 2023 at 22:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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