/TensorFlow-based-Text-Classification-with-Convolutional-Neural-Networks-Deep-Learning-in-NLP-

Successfully implemented Sentiment Analysis, a Natural Language Processing (NLP) task using TensorFlow, a Deep Learning framework on shallow Convolutional Neural Networks (CNN) architecture

Primary LanguagePython

TensorFlow based Text Classification with Convolutional Neural Networks Deep Learning in NLP

Text classification represents a general classification task such as sentiment analysis, email classification as spam or non-spam, document categorization etc. Deep learning and neural networks are getting better and better at text classification, with state-of-the-art technology such as Convolutional Neural Networks. Traditionally, CNNs have proven to be very effective for computer vision tasks such as tagging a person in the photo on social media websites, self-driving cars and many other tasks. Recently, researchers have been found out growing interest in using CNNs in Natural Language Processing (NLP) with areas such as Text Classification due to increased classification accuracy compared to other machine learning classifier models such as Naïve Bayes Classifier or SVM classifier. This project deals with the Convolutional Neural Networks applied to Text Classification with Sentiment Analysis task using Deep Learning framework TensorFlow. The dataset in this project is the Movie Review data from Rotten Tomatoes which was also used in the paper by Pang et al [1].

Model

The network built in this project has roughly following representation as mentioned in the paper by Kim Yoon [2]

The general approach for using CNN for NLP tasks as follows. First, sentences are mapped into embedding vectors and then fed to the input in the matrix form. Convolutions are performed with different-sized filters such as 2 or 3 words at the time, then max pooling layer is implemented to decrease the special size, its output is then applied to fully connected layer with dropout regularization to obtain sentence classification. The activation function in this case can be either ReLu or tanh.

CNN filter and Pooling architecture for Sentence Classification

Analysis

Accuracy Vs. No. of Iterations

References

[1] Pang, Bo, Lillian Lee, and Shivakumar Vaithyanathan. "Thumbs up?: sentiment classification using machine learning techniques." Proceedings of the ACL-02 conference on Empirical methods in natural language processing-Volume 10. Association for Computational Linguistics, 2002

Idea and the supporting code taken from the http://www.wildml.com/2015/12/implementing-a-cnn-for-text-classification-in-tensorflow/