2
$\begingroup$

I have a bunch of features that I would like to use for classification/machine learning and cluster analysis. Normally I use single point values or transformations of values for features and everything is fine

Now I would like to use a matrix as a feature. The matrix is probably going to be a fairly big (say 50x50) but will only be filled with 1's and 0's. It is pretty much an 'image' matrix. It is the shape/pattern of the matrix entries which is important.

Is there anyway I can easily use the matrix as a feature for machine learning? I know I could use each matrix entry, say Row1Column1 as a feature and then give it a value, but then I would have 2500 features from my 50x50 matrix, which is what I am trying to get away from.

Any ideas would be greatly appreciated.

$\endgroup$
4
  • 1
    $\begingroup$ Whether you interpret it as a vector or a matrix doesn't really change anything. I would not worry about 2500 features, that's not big by current standards. $\endgroup$ Oct 21, 2013 at 13:11
  • $\begingroup$ thanks marc, I guess its fair enough to use the 2500 points as individual features, I just want to make sure that the machine learning captures the 'shape/relationship of matrix elements' of the matrix vs just concentrating on which features are important and weighting them. But perhaps that is the same thing $\endgroup$ Oct 21, 2013 at 13:38
  • 2
    $\begingroup$ @user1449677 What does "pretty much an image" mean? There are a lot of different features you can compute from images, SIFT, HOG, or see the Wikipedia page Feature (computer_vision) as a jump off point. $\endgroup$
    – alto
    Oct 21, 2013 at 15:29
  • $\begingroup$ Either if you use a 50x50 matrix or 2500 vector they would consist of the same number of points so it doesn't matter. Of course, unless the matrix is symmetric and some fields can be ignored. $\endgroup$
    – Tim
    Sep 12, 2022 at 19:35

2 Answers 2

0
$\begingroup$

not sure whether the matrix is the only input to your machine learning problem or not but here are a few tips-

Incase you are going for supervised learning you can use convolutional neural networks to solve the problem and feed the matrix as input much like an image ..

Incase you are going for unsupervised learning you can use sparse encoding to represent you matrix as a sum of many many sparse matrix with different coefficients. Just take the ones having high coefficients( it's up to you how many you want to chose )

Read more on sparse encoding for clarity .. Hope this gets you started .

$\endgroup$
0
$\begingroup$

It is completely reasonable to consider the individual pixels (to continue the analogy to images) as features, giving you $2500$ features from a $50\times 50$ image. It is not clear why there should be opposition to this. The relationships between pixels in the image are captured by dependence between features, so you are not losing information by working this way, and this is probably the easiest way to proceed.

There are techniques from image processing to extract features from images, and you might find success in considering such feature extraction techniques. One of the comments mentions histogram of oriented gradients and scale-invariant feature transform. To that list, I will add Fourier and wavelet transforms. I know that I have played with wavelet transforms of MNIST digits in R.

However, you are not obviously making a mistake by considering the original features. Even the convolutional neural networks that exploit the spatial orientation of pixels in images can be viewed as fully-connected networks that use weight-sharing and parameter dropping.

$\endgroup$

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