Skip to content

Embedding-based sentiment classification system for Twitter data using Gemini embeddings and machine learning, built and documented in VS Code.

License

Notifications You must be signed in to change notification settings

coderShreyIn/Sentiment_Classification_Using_Embeddings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Sentiment Classification Using Embeddings

This project implements an embedding-based sentiment classification system that classifies Twitter tweets into Positive, Negative, or Neutral sentiments using Gemini text embeddings and machine learning.


πŸ“Œ Problem Statement

Social media platforms generate millions of posts daily, making manual sentiment analysis impractical. Understanding public sentiment helps brands, governments, and organizations make informed decisions.


🎯 Objective

The goal of this project is to build a sentiment classifier using:

  • Text preprocessing and cleaning
  • Semantic embeddings generated using Gemini
  • A machine learning classification model

πŸ“Š Dataset


πŸ› οΈ Technologies Used

  • Python
  • Pandas, NumPy
  • NLTK (text preprocessing)
  • Google Gemini Embeddings (text-embedding-004)
  • Scikit-learn (Logistic Regression)
  • Matplotlib, Seaborn
  • WordCloud
  • VS Code (Jupyter Notebook)

πŸ”„ Project Workflow

  1. Exploratory Data Analysis (EDA)
  2. Text preprocessing and cleaning
  3. Word cloud visualization
  4. Embedding generation using Gemini
  5. Model training using Logistic Regression
  6. Model evaluation using classification metrics
  7. Custom tweet sentiment prediction

πŸ“ˆ Results

  • The model successfully classifies tweets into positive, negative, and neutral categories.
  • Semantic embeddings capture contextual meaning effectively.
  • Custom user-defined tweets were accurately classified.

πŸ§ͺ Sample Predictions

-"I absolutely love this new phone!" β†’ Positive -"This service is horrible and frustrating" β†’ Negative -"The event happened yesterday" β†’ Neutral


πŸš€ How to Run the Project

  1. Clone the repository:
  1. Install required dependencies:
  • pip install -r requirements.txt
  1. Add your Gemini API key in the code:
  • api_key = "WRITE_YOUR_API_KEY_HERE"
  1. Open and run the notebook in VS Code or Jupyter Notebook.

About

Embedding-based sentiment classification system for Twitter data using Gemini embeddings and machine learning, built and documented in VS Code.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published