How to do machine learning when the inputs are of

2019-04-07 01:42发布

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 are of different dimensions, or if we want to do sentiment analysis but all of our sentences have different amounts of words, or if we want to do stellar classification but all of the stars have been observed a different number of times, 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?

2条回答
Emotional °昔
2楼-- · 2019-04-07 01:53

You can usually make the number of features the same for all instances quite easily:

if we want to do visual classification but all of our pictures are of different dimensions

Resize them all to a certain dimension / number of pixels.

if we want to do sentiment analysis but all of our sentences have different amounts of words

Keep a dictionary of the k words in all of your text data. Each instance will consist of a boolean vector of size k where the i-th entry is true if word i from the dictionary appears in that instance (this is not the best representation, but many are based on it). See the bag of words model.

if we want to do stellar classification but all of the stars have been observed a different number of times

Take the features that have been observed for all the stars.

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.

I think the speaker probably referred to higher level features. For example, you shouldn't manually extract the feature "contains a nose" if you want to detect faces in an image. You should feed it the raw pixels, and the deep learner will learn the "contains a nose" feature somewhere in the deeper layers.

查看更多
我想做一个坏孩纸
3楼-- · 2019-04-07 02:06

Since you are asking about deep learning, I assume you are more interested in end-to-end systems, rather then feature design. Neural networks that can handle variable data inputs are:

1) Convolutional neural networks with pooling layers. They are usually used in image recognition context, but recently were applied to modeling sentences as well. ( I think they should also be good at classifiying stars ).

2) Recurrent neural networks. (Good for sequential data, like time series,sequence labeling tasks, also good for machine translation).

3) Tree-based autoencoders (also called recursive autoencoders) for data arranged in tree-like structures (can be applied to sentence parse trees)

Lot of papers describing example applications can readily be found by googling.

For uncommon tasks you can select one of these based on the structure of your data, or you can design some variants and combinations of these systems.

查看更多
登录 后发表回答