This project contains a Jupyter Notebook created in Google Colab for sentiment analysis using various machine learning algorithms.
The Jupyter Notebook implements sentiment analysis on a dataset containing customer reviews and star ratings. The notebook includes data preprocessing steps, feature extraction using Bag of Words (BoW) and TF-IDF methods, and training/testing of machine learning models such as Perceptron, Support Vector Machine (SVM), Logistic Regression, and Naive Bayes.
To run the code, make sure the following packages are installed:
pandas=1.5.3=py311heda8569_0numpy=1.24.3=py311hdab7c0b_1nltk=3.8.1=py311haa95532_0scikit-learn=1.3.0=py311hf62ec03_0scikit-learn-intelex=2023.1.1=py311haa95532_0contractions
The Anaconda Python distribution is recommended as it typically comes with these packages pre-installed.
- Download the dataset from this link.
- Save the downloaded file as
data.tsvin the same folder as the Jupyter Notebook. - Install the required packages listed in the package requirements section.
- Execute the code cells in the notebook to reproduce the sentiment analysis results.
The notebook is divided into several sections:
- Data Preparation: Reading and preprocessing the dataset.
- Feature Extraction: Extracting features using Bag of Words (BoW) and TF-IDF methods.
- Model Training: Training machine learning models including Perceptron, SVM, Logistic Regression, and Naive Bayes.
- Evaluation: Evaluating the performance of the trained models using metrics like accuracy, precision, recall, and F1-score.