I have a dataset with tensors (there are 12 classes) of shape (700,2000)
- height is 700 and width is 2000. I would like to try to use an SVM classifier (just to see how it does). My question is - how do I input the data? Do I flatten it? So the input arrays would be 1 dimensional with length 700*2000
?
-
$\begingroup$ Can you clarify if (700, 2000) is the shape of the dataset, or of a single example in the dataset? Also, it might help to know what kind of software you're using. $\endgroup$– kwinkunksCommented Jul 7, 2022 at 14:07
1 Answer
In general, the software is probably expecting an $N$ examples (or records) by $M$ (features) array as the input matrix $X$, plus a 1D array of length $N$ as the expected output labels (with 12 unique values, corresponding to the 12 classes).
So if you're saying that your entire dataset is 700 × 2000, just use it as-is.
On the other hand, if you're saying that one single example of your data is 700 × 2000, then you would need to flatten each example into a 1,400,000-feature vector... but this is a very high-dimensional vector, and although SVMs are good at high-dimensional data, it can lead to problems (see the curse of dimensionality). So you could either reduce the size of the original examples, or take some steps to otherwise reduce the dimensionality of your data.