{"id":31052804,"url":"https://github.com/shervinnd/imdb-sentiment-analysis-lstm","last_synced_at":"2025-09-15T01:24:16.699Z","repository":{"id":313760682,"uuid":"1052566272","full_name":"shervinnd/IMDB-Sentiment-Analysis-LSTM","owner":"shervinnd","description":"🔍 Dive into sentiment analysis with this LSTM model on the IMDB dataset! Classify movie reviews as positive or negative with high accuracy. 📊 Features ROC curves, custom predictions, and TensorFlow-powered training. Explore code, visualizations, and results.🚀 ","archived":false,"fork":false,"pushed_at":"2025-09-08T08:41:56.000Z","size":89,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-08T10:29:56.797Z","etag":null,"topics":["binary-classification","data-science","deep-learning","imdb-dataset","jupyter-notebook","lstm","machine-learning","natural-language-processing","neural-networks","nlp","python","roc-curve","sentiment-analysis","tensorflow","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shervinnd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-08T08:31:13.000Z","updated_at":"2025-09-08T08:43:34.000Z","dependencies_parsed_at":"2025-09-08T10:29:58.683Z","dependency_job_id":"d95cb689-671f-4346-8036-b2db90ba6790","html_url":"https://github.com/shervinnd/IMDB-Sentiment-Analysis-LSTM","commit_stats":null,"previous_names":["shervinnd/imdb-sentiment-analysis-lstm"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/shervinnd/IMDB-Sentiment-Analysis-LSTM","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shervinnd%2FIMDB-Sentiment-Analysis-LSTM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shervinnd%2FIMDB-Sentiment-Analysis-LSTM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shervinnd%2FIMDB-Sentiment-Analysis-LSTM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shervinnd%2FIMDB-Sentiment-Analysis-LSTM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shervinnd","download_url":"https://codeload.github.com/shervinnd/IMDB-Sentiment-Analysis-LSTM/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shervinnd%2FIMDB-Sentiment-Analysis-LSTM/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275193550,"owners_count":25421408,"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-09-14T02:00:10.474Z","response_time":75,"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":["binary-classification","data-science","deep-learning","imdb-dataset","jupyter-notebook","lstm","machine-learning","natural-language-processing","neural-networks","nlp","python","roc-curve","sentiment-analysis","tensorflow","text-classification"],"created_at":"2025-09-15T01:24:12.549Z","updated_at":"2025-09-15T01:24:16.680Z","avatar_url":"https://github.com/shervinnd.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IMDB Sentiment Analysis with LSTM 🚀\n\n![IMDB Sentiment\nBanner](https://img.shields.io/badge/TensorFlow-2.x-orange?style=flat\u0026logo=tensorflow)\n\n![Python](https://img.shields.io/badge/Python-3.8%2B-blue?style=flat\u0026logo=python)\n\n![License](https://img.shields.io/badge/License-MIT-green?style=flat)\n\n\n🔍**A deep learning project for binary sentiment classification on IMDB\nmovie reviews.**\\\nThis Jupyter Notebook builds an LSTM-based neural network to analyze\nsentiments (positive/negative) from the IMDB dataset. It includes data\npreprocessing, model training, evaluation with ROC curves, and custom\nreview predictions.📈\n\n## 🌟 Features\n\n-   **Dataset Handling**: Loads and preprocesses the IMDB dataset (25K\n    training + 25K test reviews). 📚\n-   **Model Architecture**: Embedding + LSTM + Dense layers with dropout\n    for robust performance. 🧠\n-   **Training \u0026 Evaluation**: Trains for 5 epochs, evaluates accuracy\n    (\\~84%), and plots ROC curves (AUC \\~0.93). 📊\n-   **Custom Predictions**: Test the model on your own movie reviews!\n    ✅/❌\n-   **Visualizations**: Accuracy plots and ROC curves using Matplotlib.\n    🎨\n\n## 🛠️ Installation\n\n1.  Clone the repo:\n\n    ``` bash\n    git clone https://github.com/shervinnd/IMDB-Sentiment-Analysis-LSTM.git\n    cd IMDB-Sentiment-Analysis-LSTM\n    ```\n\n2.  Install dependencies (use a virtual environment recommended):\n\n    ``` bash\n    pip install tensorflow numpy matplotlib scikit-learn\n    ```\n\n3.  Open the Jupyter Notebook:\n\n    ``` bash\n    jupyter notebook IMBD.ipynb\n    ```\n\n## 🚀 Usage\n\n1.  **Run the Notebook**: Execute cells sequentially to load data,\n    build/train the model, and evaluate.\n\n2.  **Custom Review Testing**: Use the `encode_text` function for new\n    reviews. Example:\n\n    ``` python\n    sample_text = \"This movie was amazing!\"\n    encoded = encode_text(sample_text)\n    prediction = model.predict(encoded)\n    print(\"Positive ✅\" if prediction[0][0] \u003e 0.5 else \"Negative ❌\")\n    ```\n\n3.  **Visualize Results**: Check the ROC curve plot for performance\n    insights. 📉\n\n## 🧩 Model Architecture\n\n``` plaintext\n- Embedding Layer: 10,000 vocab size, 32 dimensions, input length 200.\n- LSTM Layer: 64 units.\n- Dense Layer: 64 units (ReLU) + Dropout (0.5).\n- Output: Sigmoid for binary classification.\n```\n\nCompiled with Adam optimizer and binary cross-entropy loss. Achieves\n\\~84% test accuracy after 5 epochs! 💪\n\n## 📊 Results\n\n-   **Test Accuracy**: 84.26% ✅\n-   **ROC AUC**: \\~0.93 (visualized in the notebook).\\\n    Example Predictions:\n-   \"The movie was fantastic and I really enjoyed it\" → Positive ✅\n-   \"The movie was terrible and I absolutely hated it\" → Negative ❌\n\nTraining History (sample):\n\n  Epoch   Train Acc   Val Acc\n  ------- ----------- ---------\n  1       55.78%      82.80%\n  5       95.31%      84.38%\n\n## 🤝 Contributing\n\nPull requests welcome! For major changes, open an issue first. 😊\n\n1.  Fork the repo.\n2.  Create a feature branch (`git checkout -b feature`).\n3.  Commit changes (`git commit -m`).\n4.  Push to the branch (`git push origin feature`).\n5.  Open a Pull Request.\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the LICENSE file\nfor details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshervinnd%2Fimdb-sentiment-analysis-lstm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshervinnd%2Fimdb-sentiment-analysis-lstm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshervinnd%2Fimdb-sentiment-analysis-lstm/lists"}