Skip to content

Commit

Permalink
Merge pull request #454 from Shobhit-Bandhu/stock-news-sentiment-anal…
Browse files Browse the repository at this point in the history
…ysis

Stock News Sentiment Analysis
  • Loading branch information
abhisheks008 authored Jan 2, 2024
2 parents 3999cea + e3f1cb8 commit 2149702
Show file tree
Hide file tree
Showing 8 changed files with 114,347 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Stock News Sentiment Analysis/Dataset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Dataset:
https://www.kaggle.com/datasets/avisheksood/stock-news-sentiment-analysismassive-dataset

# Columns:
Sentiment: 0 represents a negative/neutral sentiment and 1 represents a positive sentiment.

Sentence: The text upon which sentiment analysis is to be performed.

# About this file:
0 represents that the news is negative or neutral (Therefore the stock will likely go down)
1 represents that the news is positive (Therefore the likely stock will go up)
110,736 changes: 110,736 additions & 0 deletions Stock News Sentiment Analysis/Dataset/Sentiment_Stock_data.csv

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions Stock News Sentiment Analysis/Model/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Stock News Sentiment Analysis

**PROJECT TITLE**

**GOAL**

The goal is to perform sentiment analysis on stock market news. It is a binary classification problem, where
- label==1 signifies positive sentiment, and,
- label==0 signifies neutral or negative sentiment.

**DATASET**

https://www.kaggle.com/datasets/avisheksood/stock-news-sentiment-analysismassive-dataset

**DESCRIPTION**



**WHAT HAVE I DONE**

- Removed stopwords, punctuations, made text lowercase, and lemmatized text to base form.
- Made WordClouds for:
- The entire dataset
- Words featured in positive sentiments
- Words featured in negative sentiments
- Vectorized text using TF-IDF vectorizer
- Applied classification on a dataset with:
- Parameter: TF-IDF vectors
- Label: Encoded sentiment

**MODELS USED**

Classification algorithms like:
- Logistic regression
- Naive-Bayes classifier
- SVM classifier
- Random Forest Regressor

**LIBRARIES NEEDED**

- numpy
- pandas
- matplotlib
- nltk
- textblob
- wordcloud
- sklearn
- tensorflow

**VISUALIZATION**
- Sentiment distribution (1 and 0)
![Alt text](../Images/Sentiment_distribution.png)
- WordCloud for overall dataset
![Alt text](../Images/WordCloud.png)
- WordCloud for negative sentiment text only
![Alt text](../Images/WordCloud_negative.png)
- WordCloud for positive sentiment text only
![Alt text](../Images/WordCloud_positive.png)

**ACCURACIES**

Ranking models based on accuracy:

- DistilBert: 54.70%
- Naive-Bayes: 54.42%
- SVM: 53.67%
- Random Forest Classifier: 53.86%
- Logistic Regression: 53.17%


**CONCLUSION**

All used models give a similar performance while using TF-IDF vectorization.

**YOUR NAME**

- Name: Shobhit Bandhu
- College: JU B.Prod '27
- LinkedIn: https://www.linkedin.com/in/shobhit-bandhu/
Loading

0 comments on commit 2149702

Please sign in to comment.