Skip to content

sentiment classification on text data using Support Vector Machine (SVM) and TF-IDF vectorization machine learning algorithm. This project was made for the fulfillment of the Skills Union Data Science and AI Certification.

Notifications You must be signed in to change notification settings

NoorNick/Text-Classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’¬ Sentiment Analysis using SVM and TF-IDF

This project demonstrates how to perform sentiment classification on text data using Support Vector Machine (SVM) and TF-IDF vectorization. The model predicts whether a text expresses positive or negative sentiment based on learned patterns from a small sample movie review dataset.


πŸš€ Features

  • Converts raw text to numeric features using TF-IDF
  • Trains an SVM classifier with a linear kernel (ideal for text classification)
  • Evaluates performance using a classification report
  • Extracts and plots the most influential positive and negative features
  • Visualizes top coefficients contributing to sentiment prediction

πŸ“ Dataset

A synthetic list of short movie reviews with manually labeled sentiments:

  • 1 = Positive sentiment
  • 0 = Negative sentiment

πŸ“Š Example Output

              precision    recall  f1-score   support

    Negative       1.00      0.75      0.86         4
    Positive       0.80      1.00      0.89         4

    accuracy                           0.88         8
   macro avg       0.90      0.88      0.88         8
weighted avg       0.90      0.88      0.88         8

And a bar chart visualizing top positive and negative words based on their SVM coefficients.


πŸ› οΈ How to Run

  1. Clone the repository:
git clone https://github.com/NoorNick/Text-Classification.git
cd Text-Classification

  1. Install the required packages:
pip install -r requirements.txt
  1. Launch the notebook:
jupyter notebook

Then open text_classification.ipynb and run all cells.


πŸ“Œ Techniques Used

  • TF-IDF Vectorization for feature extraction

  • Support Vector Machine (SVC) for classification

  • Train-test split with sklearn

  • Interpretability through feature coefficient analysis


Train smarter, classify better. πŸ§ πŸ“Š

About

sentiment classification on text data using Support Vector Machine (SVM) and TF-IDF vectorization machine learning algorithm. This project was made for the fulfillment of the Skills Union Data Science and AI Certification.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published