Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stock News Sentiment Analysis #454

Merged
Merged
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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the README.md template and update it accordingly. Here is the template, https://github.com/abhisheks008/ML-Crate/blob/main/.github/readme_template.md


**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