eGitty

Discover The Most Popular Algorithms

3 Methods to Incorporate Multiple Features in Deep Learning

In deep learning, we may use multiple features to inprove the final performance in one model. For example, in sentiment analysis, you may use sentiment lexicon feature and sentence context feature.

How to incorporate multiple features in one model?

If you plan to use two kinds of features, how to use them?

Paper:  Lexicon Integrated CNN Models with Attention for Sentiment Analysis give us 3 methods to incorporate them.

Method 1: Naive concatenation

It looks like:

3 Methods to Incorporate Multiple Features in Deep Learning - Naive Concatenation

This method is a common way, many models use this method to incorporate multiple features.

For example, one feature is 1*200, the other is 1*200, then we will get a new feature with 1*400. In tensorflow, it is:

n = tf.concat([f1, f2], axis = -1)

Method 2: Multichannel concatenation

This method concatenates multiple features on channel dimension.

It looks like:

3 Methods to Incorporate Multiple Features in Deep Learning - multichannel Concatenation

However, this method we should notice features have the same dimension, otherwise, we need pad them with 0 to the same.

In tensorflow, we can view it as:

n = tf.concat([f1, f2], axis = 1)

Method 3: Separate modeling

We do not incorporate them when inputing, we incorporate them in the final layer.

Here is an example:

3 Methods to Incorporate Multiple Features in Deep Learning - Separate modeling

Which method has the best performance?

This paper used 3 methods above to make an experiment, we can find method 3 is the best.

Here is the comparative result:

Which method have best performance in 3 incorporate feature methods

Leave a Reply

Your email address will not be published. Required fields are marked *