GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com โ€” GitHub - Hasnath-Unnisa/Sentiment_Analysis_with_NLP_Techniques: Sentiment Analysis using NLP and Machine Learning to classify IMDB movie reviews into positive or negative sentiments.

BranchesTags
Open more actions menu

Latest commit

 

History

8 Commits
8 Commits

Folders and files

NameName
Last commit message
Last commit date
Documentation
Documentation
 
 
Source_code
Source_code
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
imdb_reviews_with_emotions (1).csv
imdb_reviews_with_emotions (1).csv
 
 
requirements.txt
requirements.txt
 
 

Repository files navigation

๐ŸŽฏ Sentiment & Emotion Analysis Using NLP Techniques

This project applies Natural Language Processing (NLP) and Machine Learning (ML) techniques to classify text data into emotions such as happy or frustrated.
The workflow follows the CRISPโ€“DM methodology, demonstrating each phase โ€” from business understanding to evaluation.


๐Ÿ“˜ Project Overview

This notebook demonstrates an end-to-end sentiment analysis pipeline:

  • Text preprocessing (tokenization, stopword removal, lemmatization)
  • Feature extraction using TF-IDF vectorization
  • Training and comparison of multiple ML models
  • Evaluation and insights on model behavior and data quality

๐Ÿงฉ Objectives

  • Understand and preprocess raw text data
  • Apply vectorization to convert text into numeric form
  • Train and evaluate several classification models
  • Analyze performance limitations on small/imbalanced datasets

๐Ÿ“Š Dataset

  • Total samples: 25 (โ‰ˆ30 KB)
  • Classes: happy, frustrated
  • Features after TF-IDF: 1 404
  • Train/Test split: 80 % / 20 %

โš ๏ธ This dataset is for demonstration only โ€” it is too small for production-level modeling.


โš™๏ธ Methodology

Phase Description
Business Understanding Define the goal โ€” classify emotions in short text reviews.
Data Understanding Explore the dataset, check class balance and sample distribution.
Data Preparation Clean text, remove stopwords, tokenize & lemmatize, create TF-IDF features.
Modeling Train models โ€” Naive Bayes, Logistic Regression, KNN, Decision Tree, Random Forest.
Evaluation Compare results using Accuracy, Precision, Recall, and F1-Score.
Deployment Demonstrate prediction logic; ready for integration via Flask/FastAPI.

๐Ÿงฎ Model Evaluation Results

Metric Training Testing
Accuracy 0.80 0.40
Precision 0.84 0.16
Recall 0.80 0.40
F1-Score 0.80 0.23

Confusion Matrix

Predicted Frustrated Predicted Happy
Actual Frustrated 0 3
Actual Happy 0 2

The model tends to overpredict happy and fails to capture frustrated due to the small, imbalanced dataset.
Overfitting is visible: excellent training accuracy, poor test performance.


๐Ÿง  Insights & Observations

  • KNN, Decision Tree, and Random Forest overfit heavily on the small dataset.
  • Logistic Regression provides a consistent baseline but still limited by data size.
  • Hyperparameter tuning did not improve results โ€” lack of data is the main bottleneck.
  • The pipeline itself is reproducible and educational for NLP beginners.

๐Ÿš€ Future Improvements

  • Collect a larger balanced dataset (โ‰ฅ 1 000 samples)
  • Apply SMOTE or other resampling for class balance
  • Use cross-validation
  • Experiment with Word2Vec, LSTM, or BERT embeddings
  • Deploy model via Flask or FastAPI for live sentiment prediction

๐Ÿงฐ Tech Stack

  • Language: Python 3
  • Libraries:
    pandas, numpy, nltk, scikit-learn, spacy, matplotlib, seaborn, wordcloud, PyPDF2, python-docx

๐Ÿงพ Project Structure

NLP_Sentiment_Analysis/
โ”‚
โ”œโ”€โ”€ Data/ # Dataset and cleaned data
โ”œโ”€โ”€ Source_code/ # Jupyter notebook (Sentiment_Analysis.ipynb)
โ”œโ”€โ”€ Documentation/ #Report
โ”œโ”€โ”€ requirements.txt # Python dependencies
โ”œโ”€โ”€ .gitignore # Ignore unnecessary files
โ””โ”€โ”€ README.md # 

โš™๏ธ Installation & Setup

  1. Clone the repository
    git clone https://github.com/Hasnath-Unnisa/Sentiment_Analysis_with_NLP_Techniques.git
    cd Sentiment_Analysis_with_NLP_Techniques
    
  2. Create virtual environment

python -m venv .venv source .venv/Scripts/activate # Windows

3.Install dependencies

pip install -r requirements.txt

  1. Run the notebook

jupyter notebook Source_code/Sentiment_Analysis.ipynb

๐Ÿ Results Summary

Best Model: Logistic Regression

Accuracy: 40 %

Observation: Overfitting due to small dataset

Recommendation: Increase dataset size and test deep learning models

๐Ÿ‘ฉโ€๐Ÿ’ป Author

Name: Hasnath Unnisa
Email: [email protected]
LinkedIn: www.linkedin.com/in/hasnath22

About

Sentiment Analysis using NLP and Machine Learning to classify IMDB movie reviews into positive or negative sentiments.

Topics

bag-of-wordsdata-analysisfeature-engineeringgenismnlp-machine-learningpythonsentiment-analysistext-classificationword2vec

Resources

Readme
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 โ€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800ร—600. No cookies required.