{"id":17695590,"url":"https://github.com/rahul-vinay/sentimentlens","last_synced_at":"2026-04-11T04:32:51.986Z","repository":{"id":258308003,"uuid":"870133796","full_name":"rahul-vinay/SentimentLens","owner":"rahul-vinay","description":"A sentiment analysis model using Bidirectional LSTM, Attention Mechanism and pre-trained GloVe embeddings, implemented with Keras.","archived":false,"fork":false,"pushed_at":"2024-10-09T15:15:22.000Z","size":155,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T23:43:52.848Z","etag":null,"topics":["attention-mechanism","data-science","keras","lstm-neural-networks","natural-language-processing","python","pytorch","sentiment-analysis","text-classification"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rahul-vinay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-09T13:57:11.000Z","updated_at":"2024-10-16T14:47:50.000Z","dependencies_parsed_at":"2024-10-18T11:44:35.663Z","dependency_job_id":"4c7b8f30-a27d-41b8-a9c3-74f14822fbe2","html_url":"https://github.com/rahul-vinay/SentimentLens","commit_stats":null,"previous_names":["rahul-vinay/sentimentlens"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rahul-vinay/SentimentLens","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahul-vinay%2FSentimentLens","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahul-vinay%2FSentimentLens/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahul-vinay%2FSentimentLens/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahul-vinay%2FSentimentLens/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rahul-vinay","download_url":"https://codeload.github.com/rahul-vinay/SentimentLens/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahul-vinay%2FSentimentLens/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267967720,"owners_count":24173566,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["attention-mechanism","data-science","keras","lstm-neural-networks","natural-language-processing","python","pytorch","sentiment-analysis","text-classification"],"created_at":"2024-10-24T14:06:08.525Z","updated_at":"2025-12-30T21:54:23.785Z","avatar_url":"https://github.com/rahul-vinay.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"## SentimentLens: Decoding Emotions in IMDB Movie Reviews with Deep Learning\nA sentiment analysis model using Bidirectional LSTM, Attention Mechanism and pre-trained GloVe embeddings, implemented with Keras.\n\nThis project implements a Sentiment Analysis model using a Bidirectional Long Short-Term Memory (LSTM) network with an Attention Mechanism. The model is trained on the IMDB movie reviews dataset and utilizes pre-trained GloVe embeddings to enhance word understanding.\n\n## Table of Contents\n- [Project Overview](#project-overview)\n- [Model Architecture](#model-architecture)\n- [Dataset](#dataset)\n- [Installation](#installation)\n- [How to Run](#how-to-run)\n- [Results](#results)\n- [Future Work](#future-work)\n\n  ---  \n\n## Project Overview\nThis project applies deep learning techniques to classify movie reviews based on their sentiment—positive or negative. The model is trained using the IMDB Movie Reviews dataset, which contains 50,000 labeled reviews. Key components include:\n- **Bidirectional LSTM** for learning sequential information from both directions of the text.\n- **Attention Mechanism** to focus on important parts of the review.\n- **Pre-trained GloVe Embeddings** for rich semantic representation of words.\n\n---\n\n## Model Architecture\nThe model consists of:\n- **Embedding Layer**: Uses GloVe embeddings for word representations.\n- **Bidirectional LSTM**: Captures long-term dependencies from both directions in the text.\n- **Attention Layer**: Focuses on key parts of the input sequence to enhance performance.\n- **Dense Layers**: Fully connected layers to process the output of the LSTM and Attention layers.\n- **Output Layer**: Uses sigmoid activation for binary classification (positive or negative sentiment).\n\n---\n\n## Dataset\n\nWe use the [IMDB Movie Reviews Dataset](https://www.kaggle.com/datasets/lakshmi25npathi/imdb-dataset-of-50k-movie-reviews), which consists of 50,000 movie reviews labeled as either positive or negative. The dataset is balanced with 25,000 positive and 25,000 negative reviews.\n\n---\n\n## Installation\n\nTo run this project locally, follow the steps below:\n\n1. **Clone the Repository**:\n   ```bash\n   git clone https://github.com/rahul-vinay/SentimentLens.git\n   cd SentimentLens\n   \n2. **Install the dependencies**\n   ```bash\n   pip install -r requirements.txt\n\n3. **Download GloVe Embeddings**:\n   ```bash\n   wget http://nlp.stanford.edu/data/glove.6B.zip\n   \n   unzip glove.6B.zip\n\n## How to Run\n1. **Run the Notebook**:   \n- You can open the .ipynb file (e.g., SentimentLens.ipynb) in Jupyter Notebook or Google Colab.\n- Follow the cells in the notebook to preprocess the data, train the model, and evaluate performance.\n\n2. **Save and Load the Model**:\n- After training, save the model:\n  ```bash\n  best_model.save('best_sentiment_model.keras')\n  \n- To load the model later:\n  ```bash\n  from keras.models import load_model\n  \n  model = load_model('best_sentiment_model.keras')\n\n## Results:\nThe model achieved the following results on the test set:\n\n- **Test Accuracy**: ~87.94%\n  \n- **Confusion Matrix**: Illustrates the classification performance.\n  \n  \n  ![Confusion Matrix](images/confusion_matrix.png)\n  \n    \n\n- **Classification Report**: Shows precision, recall and F1 score for each class.\n\n\n![Classification report](images/classification_report.png)  \n    \n  \n\n  Some example outputs:\n\n     \n    review2 = \"This movie is terrible. I hate it.\"\n  \n    sentiment2 = sentiment_prediction(review2)\n  \n    print(f\"Review: {review2}\\nSentiment: {sentiment2}\")\n    \n\n![Negative Review](images/output1.png)\n\n\n\n    review3 = \"I would watch this movie again.\"\n\n    sentiment3 = sentiment_prediction(review3)\n\n    print(f\"Review: {review3}\\nSentiment: {sentiment3}\")\n    \n    \n\n![Positive Review](images/output2.png)\n\n\n \n## Future Work\n\n- **Explore Transformer Models**: Implement BERT or GPT models to improve sentiment classification.\n  \n- **Data Augmentation**- Experiment with data augmentation techniques to enrich the training data.\n  \n  \n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahul-vinay%2Fsentimentlens","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frahul-vinay%2Fsentimentlens","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahul-vinay%2Fsentimentlens/lists"}