Skip to content

NLP-based sentiment classifier for user reviews using TF-IDF, Naïve Bayes, and Transformer models, deployed via Streamlit for real-time insights.

Notifications You must be signed in to change notification settings

itz-Mayank/AI_Echo

Repository files navigation

AI Echo: ChatGPT Sentiment Analysis

Python Streamlit Scikit-Learn

An end-to-end NLP project that performs sentiment analysis on user reviews of the ChatGPT application. This repository contains the code for data analysis, machine learning model training, and a deployed interactive web application.


Live Demo


🎯 Problem Statement

Sentiment analysis is a natural language processing (NLP) technique used to determine the sentiment expressed in a given text. This project aims to analyze user reviews of a ChatGPT application and classify them as Positive, Neutral, or Negative. The goal is to gain insights into customer satisfaction, identify common concerns, and ultimately enhance the application's user experience.


🛠️ Tech Stack

  • Language: Python 3.9+
  • Data Manipulation: Pandas, NumPy
  • Data Visualization: Matplotlib, Seaborn, WordCloud
  • NLP: NLTK
  • Machine Learning: Scikit-learn
  • Web App Framework: Streamlit

📈 Project Pipeline

The project follows a standard machine learning pipeline:

  1. Data Loading: The chatgpt_style_reviews_dataset.xlsx is loaded.
  2. Exploratory Data Analysis (EDA): Visualizations are generated to understand distributions, trends, and key phrases.
  3. Data Preprocessing: Text data is cleaned, tokenized, lemmatized, and stopwords are removed.
  4. Feature Engineering: Cleaned text is converted into numerical features using TF-IDF vectorization.
  5. Model Training: Several models (Logistic Regression, Naive Bayes, etc.) are trained and the best one is selected after hyperparameter tuning.
  6. Deployment: The trained model and vectorizer are saved and served via an interactive Streamlit web application.

⚙️ Setup and Installation

Follow these steps to run the project locally:

  1. Clone the Repository:

    git clone https://github.com/itz-Mayank/AI_Echo.git
    cd AI_Echo
    
  2. Create a Virtual Environment (Recommended):

    python -m venv venv
    source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
  3. Install Dependencies:

    pip install -r requirements.txt
    
  4. Download Dataset:

    • Place your dataset (e.g., chatgpt_style_reviews_dataset.xlsx) in the root directory of the project.
  5. Run the Training Pipeline (Optional):

    • To retrain the model and generate the EDA plots, run the main Python script.
    python AI_echo.ipynb
    
  6. Run the Streamlit App:

    • Ensure the sentiment_model.pkl and tfidf_vectorizer.pkl files are in the Models folder.
    streamlit run app.py
    

    Your browser will open with the running application.


📁 File Structure

├── app.py  
├── AI_echo.ipynb         
├── requirements.txt     
├── Models/
    ├── sentiment_model.pkl       
    ├── tfidf_vectorizer.pkl   
├── eda_visualizations/
└── chatgpt_style_reviews_dataset.xlsx

📊 Results

The final model is a Logistic Regression classifier trained on the provided 50-row dataset. The model was evaluated on the same data it was trained on to measure its memorization capability, as per the project requirements.

The model achieved an outstanding 98% accuracy, demonstrating its ability to perfectly learn the patterns within this specific dataset.

Performance Report

Precision Recall F1-Score Support
Negative 0.95 1.00 0.98 20
Neutral 1.00 0.92 0.96 13
Positive 1.00 1.00 1.00 17
Accuracy 0.98 50
Macro Avg 0.98 0.97 0.98 50
Weighted Avg 0.98 0.98 0.98 50

Note: This high performance reflects the model's ability to memorize a small, specific dataset. For a model that can generalize to new, unseen reviews, a much larger and more diverse dataset would be required.


Author

Created and developed by Mayank Meghwal.

About

NLP-based sentiment classifier for user reviews using TF-IDF, Naïve Bayes, and Transformer models, deployed via Streamlit for real-time insights.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published