-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
abhisheks008
merged 16 commits into
abhisheks008:main
from
Shobhit-Bandhu:stock-news-sentiment-analysis
Jan 2, 2024
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
fd3c594
Initial commit
Shobhit-Bandhu 4412c37
Added readme to dataset
Shobhit-Bandhu 2fa5e86
Added model readme.md (To be updated later)
Shobhit-Bandhu 6115a2b
Small edits
Shobhit-Bandhu b9ed988
Added images and wordcloud
Shobhit-Bandhu bfa83d9
Added SVM Model
Shobhit-Bandhu ce6dfe9
Added CNN model - Failed to run
Shobhit-Bandhu c7a18f7
Added CNN model, failed running it
Shobhit-Bandhu c04aa8b
Added Random forest classifier
Shobhit-Bandhu 0ef60af
Finished the models
Shobhit-Bandhu 87ad68a
Update README.md
Shobhit-Bandhu c8ea6fc
Completed readme.md for model
Shobhit-Bandhu ec7ebb0
Removed CNN model
Shobhit-Bandhu afe7853
Added DistilBERT model
Shobhit-Bandhu ebb3cd0
Modified DistilBERT model
Shobhit-Bandhu e3f1cb8
Update README.md
Shobhit-Bandhu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
110,736
Stock News Sentiment Analysis/Dataset/Sentiment_Stock_data.csv
Large diffs are not rendered by default.
Oops, something went wrong.
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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