Wolfram Language

Enhance Sentiment Analysis Using Transfer Learning

This example demonstrates how word embeddings trained on a word-prediction task can be used to train a better sentiment analysis network.

Load a pretrained word-embedding layer from the neural net repository.

Construct a classification net starting with the embedding layer.

Load sentiment-labeled movie reviews.

Train the net using the LearningRateMultipliers option to freeze the embedding layer.

Try the network on a few examples.

Compute the accuracy of the network. Thanks to the pre-trained embedding layer, a decent sentiment-analysis net has been trained in about one minute and only using a small amount of data.

Related Examples

de es fr ja pt-br zh