This project uses an LSTM-based neural network to perform binary classification of the Sentiment140 dataset. The model predicts whether a given tweet expresses positive or negative sentiment.
- Data Preprocessing: Includes tokenization, cleaning, and lemmatization of tweets to create structured input for the model.
- Custom Embedding Layer: Utilizes pre-trained GloVe embeddings for word representation, ensuring robust vectorization of textual data.
- Model Design: A two-layer bidirectional LSTM with dropout for regularization, trained using the Adam optimizer.
- Performance: Trained on a subset of the Sentiment140 dataset (~1.6M tweets), achieving effective sentiment classification.
- Data Preprocessing:
- Tokenization using NLTK.
- Lemmatization with POS tagging.
- Noise removal (URLs, mentions, punctuation, and stopwords).
- Visualization: Generates word clouds of frequent words for exploratory data analysis.
- Model:
- Embedding layer built from GloVe.
- Bidirectional LSTMs for context-aware text analysis.
- Dropout for overfitting prevention.
- Custom Predictions: Easily classify custom text strings using the trained model.
The model can predict custom sentences with confidence, such as:
print(predict_custom_string("I love chocolate")) # Output: ~0.93 (positive)
print(predict_custom_string("I hate chocolate")) # Output: ~0.09 (negative)The Sentiment140 dataset is used for training and testing. It contains 1.6 million tweets labeled as positive (4) or negative (0).
For more details, refer to the notebook.

