3
$\begingroup$

In standard cookbook machine learning, we operate on a rectangular matrix; that is, all of our data points have the same number of features. How do we cope with situations in which all of our data points have different numbers of features? For example if we want to do visual classification but all of our pictures have different numbers of pixels, or if we want to do sentiment analysis but all of our sentences have different amounts of words, etc.

I think the normal way would be to extract features of regular size from these irregularly sized data. But I attended a talk on deep learning recently where the speaker emphasized that instead of hand-crafting features from data, deep learners are able to learn the appropriate features themselves. But how do we use e.g. a neural network if the input layer is not of a fixed size?

$\endgroup$
  • $\begingroup$ Maybe you can take a look at PCA algorithms $\endgroup$ – el Josso Jul 8 '16 at 8:39
  • $\begingroup$ @elJosso I have used PCA, but as far as I know, PCA works when the number of columns is fixed a priori. I don't think you can, for example, use PCA on full sentences of different lengths, or from lists of measurements where the lists are of different lengths. $\endgroup$ – rhombidodecahedron Jul 8 '16 at 11:09
  • $\begingroup$ Maybe not, You're right. $\endgroup$ – el Josso Jul 8 '16 at 11:29
2
$\begingroup$

I think this must be solved on a case-by-case basis. As for your first example, document analysis, probably based on bag-of-words, then you simply take the union of the two bags and introduce zero counts.

As for the image example, one commenter ask for scaling up the images with lowest resolution. Maybe that is the only solution, but then you will have some new pixels with values which are correlated with correlation equal to one! and that must be accounted for in the model.

$\endgroup$
0
$\begingroup$

I would try normalizing the data size using whatever algorithm provides the best results for your application. So if you're using images of variable resolution, before entering the image into the network you could scale or crop the image to the input size of the network.

$\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.