Vineel Rayapati
Data Scientist
Neural Networks: Predicting News Tone on Charger Removal
Overview
Inspired by the human brain, neural networks (NNs) are effective machine learning models. Composed of layers of linked "neurons," they process and learn from data using several weighted connections. Because they can find complicated patterns, NNs are perfect for jobs like text categorization, language translation, and image identification.
This project used Keras to implement a feedforward neural network for sentiment classification on news stories about smartphone charger removal. Each article was marked Pro, Neutral, or Against, so the model could learn and forecast the tone of the material depending on the input features. The aim was to know how sentiment changes across various media narratives regarding this policy.

Data Preparation
We employed the same labeled dataset used for Naïve Bayes, Decision Trees, and SVM. TF-IDF transformation, which highlights the relevance of meaningful words across all papers, converted the text features into numerical form.
Label encoding converted the labels (Pro, Neutral, Against) into integers to fit the output layer of the neural network. The dataset was subsequently divided into:
-
80% training set – used to train the neural network
-
20% testing set – used to evaluate its predictive performance
​
This disjoint split guaranteed fair model assessment and avoided data leakage. Stratified sampling was used to proportionally represent each class in both sets.

Code
We used Keras (TensorFlow backend) to build a simple feedforward neural network consisting of:
-
An input layer
-
Two hidden layers with ReLU activation and dropout for regularization
-
An output layer with softmax activation for 3-class prediction
The model was trained for 10 epochs with a batch size of 8. It used sparse categorical cross-entropy as the loss function and Adam optimizer for training.
Results & Interpretation
​The neural network's overall accuracy of 47% was quite remarkable. This puts it on par with conventional models like Naïve Bayes and Decision Trees; what distinguishes it is its capacity to generalize nonlinear patterns employing layered transformations.
The Neutral sentiment class had the greatest recall (70%), indicating the NN's ability to find articles neither strongly supportive nor critical. The model was able to make balanced predictions across all three sentiment
categories even in complicated situations.
​
Confusion Matrix Visualization:
​A strong accomplishment for a multi-class problem, this matrix demonstrates the model's predictive power for Neutral articles (13 correctly classified) and displays a respectable distribution across Pro and Against.
​

Classification Report Summary

The outcomes demonstrate the neural network's capacity to process textual subtleties, and its performance may be further enhanced with additional training data or embedded word features (such as BERT). It adds a contemporary deep learning touch to the analysis and functions as a solid finish in our model lineup for this project.
Conclusion
​Our sentiment analysis pipeline benefited from the Neural Network model's contemporary deep learning methodology, which produced promising outcomes. The model obtained a respectable 47% accuracy despite the small size of the dataset and the overlapping language in news headlines. Most significantly, it showed a high recall for neutral articles, which were frequently the hardest to distinguish from content that expressed opinions.
This model is unique because it can identify hidden patterns and nonlinear relationships that more straightforward models like Decision Trees or Naïve Bayes might overlook. Although there was progress in all three sentiment categories, the model was especially good at identifying the more impartial, balanced tone of neutral articles.
​
​Despite the fact that Pro and Against sentiments were sometimes mistaken for Neutral, the network consistently classified all classes correctly, according to the model's confusion matrix. This is a good result for a multi-class sentiment task. Its performance could be improved with additional training data, tweaking, or the addition of word embeddings like Word2Vec or BERT.
In the context of this project, the neural network enhanced the sentiment classification effort while also validating earlier findings. It illustrated how media tone detection, a task that is becoming more and more crucial in the age of information overload and narrative shaping, can be greatly aided by deep learning.