Skip to content

Latest commit

 

History

History
197 lines (149 loc) · 9.33 KB

README.md

File metadata and controls

197 lines (149 loc) · 9.33 KB

sentiment-analysis

In this repository, I am going to perform sentiment analysis on food reviews dataset step by step.

Requirements

DOWNLOAD CODE :

  1. Download the code from github
  2. Download all above mentioned dependencies.
  3. Open downloaded folder inside jupyter notebook.
  4. Now cells as per your requirements.

STEP 1: Load Dependencies

Here you need to import all the required libraries. I have used pysttx3 for text to speech conversion. You can skip this part if you want to show prediction in text format only.

STEP 2: Load and prepare data

Note: You can find dataset inside github repository link (given above). In repository, you will find a file named "Restaurant_Reviews.tsv"

STEP 3: Data Cleaning

STEP 4: Split Data

Now, we have to split data into training and testing dataset. So that, we can train model on raining data and check its accuracy on unseen data.

STEP 5: Tokenization

Now, we have to convert text data into numeric form. I have used CountVectorizer() for this.

STEP 6: Model Training

As we have done the required data preprocessing, now it is the time to train mode. Here, I will use two different model and I will compare the performance of these two model. Eventually, I will pick best fit model.

STEP 7: Make Prediction

STEP 8: Evaluation

Now it is the time to compare performance of Logistic Regression and Naive Bayes Algorithms on given dataset.

As we can see in the result above, Logistic Regression performed comparatively well. So we can continue with Logistic Regression Model.

STEP 9: Parameter Tuning [Optional]

You can find best value for parameters using Grid Search CV method.

STEP 10: Result Visualization

STEP 11: Check Models' performance on real data

STEP 12: Export Model To pkl file

It is clear now that LR model is best fit model for that particular data. However, parameter tuning can be done in order to import its score. Now we will export model and tokenizer to pkl files and then we will deploy this model to a small desktop application.

STEP 13: Create simple desktop application using Tkinter.

In this step, I have created a simple desktop application to predict food reviews. I have used pyttsx3 model to convert text prediction into voice.

RESULTS

VISIT MY YOUTUBE CHANNEL FOR MORE DETAILS: https://youtu.be/D2t-P3zEeSk