Is it possible to write a program using deep learning that categorizes an article (news, entertainment,..., etc. ) into a positive category or negative category based on a specific theme?

  • $\begingroup$ Do you want to tag articles according to topics? $\endgroup$
    – Emre
    Commented Dec 15, 2016 at 0:04
  • $\begingroup$ According to the material. For example, if I pic a subject let say trump, al gore etc. (I'm thinking to use this for people mostly) I want for the program to scan through as many recently article written about them as possible and tell me if the stories are positive or negative and the topic the story is about. Also would like to visuals this data. $\endgroup$
    – Andronik
    Commented Dec 15, 2016 at 0:11

1 Answer 1


Yes, this is classic sentiment analysis. You'll need training data in order to write this program.

Typically, people will build a language modeling using the text data in the article, tweets, posts, etc. Most folks specify the language model using a Recurrent Neural Network with a Long Short Term Memory. Here's a blog post that has code linked to their github.

Before diving into a more advanced deep neural network like an LSTM, it may be easier to start with a multilayer perceptron using n-grams.

It seems like you may be asking for a couple of different things. So, let me be very explicit. The models I listed above take as input the articles and a label that evaluated the articles as either positive or negative sentiment, the model then returns the likelihood of a given article being positive or negative sentiment. It in no way returns a topic.

To return the "topic" your best bet would be to run Latent Dirichlet Allocation, which would then return the likelihood of a given article being generated from a given topic that was previously learned. It's important to note that these will only be from topics learned on previous training data and not on new topics.

There are standard algorithms available to visualize topic models (e.g., LDAVis) and the embeddings of language models (e.g., word2vec visualizations).

It's worth noting that there is research being done in learning these items jointly (i.e., the latent topic and the classification of good/bad). I'd recommend reviewing this paper.

It may be worth reviewing these items more thoroughly before actually diving into applying them. It sounds like you may not have a complete picture of what your goal is and how deep learning can help you.

  • 2
    $\begingroup$ Worth adding that LSTMs need a lot of training data in order to out-perform simpler models such as bag-of-words plus classifier (e.g. logistic regression or SVM). As the OP is clearly just beginning to explore possible solutions, start with a simpler option rather than jumping straight to state-of-the-art. $\endgroup$ Commented Dec 15, 2016 at 7:51
  • $\begingroup$ @NeilSlater Thanks for the useufl comment. I thought about stating that before too but I also noticed he explicitly asked for "deep learning". I've updated my response to mention a simpler neural network. $\endgroup$ Commented Dec 15, 2016 at 13:36
  • $\begingroup$ No problem. There is no need to flag edits or updates in your answer, as the site will keep revisions, and the Q&A will bump to the top of the default list when you make a change. Just aim for a well-written answer, assuming some visitor finds it later on. $\endgroup$ Commented Dec 15, 2016 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.