Table of Contents
This Good Boy sniffs out the sentiment from Twitter profile and presents it in an elegant way.
Or you could also say it as Applying Sentiment Analysis on Twitter Profile and using ChartJs to visualize the result.
Client:
Server:
DataSet Used for Training : Sentiment140
Model | Training | Testing | API | |||
---|---|---|---|---|---|---|
Name | Settings | Accuracy | F1 Score | Accuracy | F1 Score | Version |
Textblob | Default | - | - | 62.24% | 0.5994 | v1 |
VaderSentiment | Default | - | - | 65.19% | 0.6453 | v2 |
Logistic Regression | Count Vect. & Lemmatization Used | 79.58% | 0.8008 | 77.92% | 0.7859 | v3-1 |
TF-IDF & Lemmatization Used | 79.80% | 0.8015 | 78.11% | 0.7856 | v3-2 | |
Bernoulli Naive Bayes | Count Vect. & Lemmatization Used | 80.36% | 0.8051 | 76.98% | 0.7733 | v4-1 |
TF-IDF & Lemmatization Used | 80.36% | 0.8052 | 76.98% | 0.7733 | v4-2 | |
Multinomial Naive Bayes | Count Vect. & Lemmatization Used | 80.37% | 0.8020 | 76.91% | 0.7680 | v4-3 |
TF-IDF & Lemmatization Used | 80.36% | 0.8051 | 76.98% | 0.7733 | v4-4 | |
Gradient Boosting Classifier | TF-IDF { min_df=5 } & Lemmatization Used . Gradient Boosting Parameters : {lr=1.5, n=150, depth=10} | 80.03% | 0.8065 | 77.00% | 0.7780 | v5-1 |
TF-IDF { min_df=5 } & Lemmatization Used . Gradient Boosting Parameters : {lr=1.25, n=300, depth=15} | 83.72% | 0.8410 | 76.89% | 0.7747 |
Following are the score for the username "elonmusk"
Model | API | Score | |
---|---|---|---|
Name | Version | Positive Score | Negative Score |
Textblob | v1 | 61.69% | 38.31% |
VaderSentiment | v2 | 69.71% | 32.09% |
Logistic Regression | v3-1 | 72.06% | 27.94% |
v3-2 | 74.07% | 25.93% | |
Bernoulli Naive Bayes | v4-1 | 68.40% | 31.60% |
v4-2 | 72.21% | 27.79% | |
Multinomial Naive Bayes | v4-3 | 67.44% | 32.56% |
v4-4 | 62.47% | 37.43% | |
Gradient Boosting Classifier | v5-1 | 64.86% | 35.14% |
GET /sentiment-v{x}/<string:username>
{x} is the version number which hosts different ML models. Check Models section for more details
Parameter | Type | Description |
---|---|---|
username |
string |
Required. Twitter Profile Username |
- Frontend using React
- Backend Model hosting on heroku using Flask Restful API
- Creating Sentiment model using TextBlob & Vader
- Custom ML Models :
- Logistic Regression
- Naive Bayes
- Multinomial
- Bernoulli
- Gradient Boosting Classifier
- Custom DL Models :
- CNN
- RNN, LSTM
- BERT
- Refactoring the WebApp Code
- Update Notebooks
- Improve Existing Models
Clone the project
git clone https://github.com/utsavk28/DetectiveDog
Install dependencies in server
folder.
cd server
python -m venv my-project-env
source my-project-env/bin/activate
pip install -r requirements.txt
Generate environment variables and fill in the values.
cp .env.example .env
Your
.env
is ignored bygit
, which you can see in.gitignore
, and so, it's safe!
Starting Development Server
python main.py
Install dependencies in client
folder.
cd ../client # If you are in ./server
npm i
change API url in ./client/src/utils/api.js to your need
Starting Client
npm start
At the end of this, you should have
- server running at
http://127.0.0.1:5000/
- new_client running at
http://localhost:3000/
To run this project, you will need to add the following environment variables to your .env file
API_KEY : Twitter API/Consumer Key
API_KEY_SECRET : Twitter API/Consumer Secret
BEARER_TOKEN : Twitter Bearer Token
ACCESS_TOKEN : Twitter Access Token
ACCESS_TOKEN_SECRET : Twitter Access Secret
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
- Pre-Processing :
- Machine-Learning-Projects Repo -> Twitter Sentiment Analysis
- ML-ProjectKart -> IMDB Sentiment Analysis
- PaperSpace Gradient Boosting Blog
- Flask Restful API Intro. & Deployment Blog
- Folder Structure Blog
- Regex Visualizer
- Regex CheatSheet
- Word Embedding Word2Vec
- StackEdit
- Sentiment Analysis using 7 techniques Kaggle
- Twitter Sentiment Analysis using Word2Vec Word Embedding
- Deep Convolutional Neural Network for Sentiment Analysis
Here are some related projects