{"id":19163435,"url":"https://github.com/lakshya-gg/spam-email-classification","last_synced_at":"2026-04-09T13:49:13.566Z","repository":{"id":155888737,"uuid":"632758686","full_name":"Lakshya-GG/Spam-Email-Classification","owner":"Lakshya-GG","description":"Spam Email Detection using ML and SOCKET.IO","archived":false,"fork":false,"pushed_at":"2023-05-01T06:42:00.000Z","size":1276,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-03T21:44:00.525Z","etag":null,"topics":["machine-learning","numpy","pandas","python","scikit-learn","socket-io","socket-programming","streamlit"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Lakshya-GG.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2023-04-26T04:26:57.000Z","updated_at":"2023-04-28T14:39:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"2ba89f7c-320a-4243-926b-375dfc8815df","html_url":"https://github.com/Lakshya-GG/Spam-Email-Classification","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lakshya-GG%2FSpam-Email-Classification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lakshya-GG%2FSpam-Email-Classification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lakshya-GG%2FSpam-Email-Classification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lakshya-GG%2FSpam-Email-Classification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lakshya-GG","download_url":"https://codeload.github.com/Lakshya-GG/Spam-Email-Classification/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240245887,"owners_count":19771029,"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","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":["machine-learning","numpy","pandas","python","scikit-learn","socket-io","socket-programming","streamlit"],"created_at":"2024-11-09T09:15:14.384Z","updated_at":"2025-12-30T19:04:05.562Z","avatar_url":"https://github.com/Lakshya-GG.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"\r\n\u003ch1\u003e 📧 Spam Email Classification \u003c/h1\u003e\r\nThe aim of this project is to suspect the E-mails which consist of offensive, anti-social elements and block them which help in identifying the suspicious user.\r\n\r\n\u003cbr\u003e\r\n\r\nSuspicious email detection is a kind of mailing system where suspicious users are identified by determining the keywords used by him/her. The keywords such as bomb, RDX, are found in the mails which are sent by the user. All these blocked mails are checked by the administrator and identify the users who sent such mails.\r\n\r\nThe given code is an implementation of a spam email classifier using the Multinomial Naive Bayes algorithm. The dataset used for training the model is \"spam.csv\", which contains labeled messages as either _\"spam\"_ or _\"ham\"_ (not spam). The dataset is read into a Pandas dataframe and preprocessed to drop unnecessary columns and map the \"ham\" and \"spam\" labels to numerical values.\r\n\r\nThe text data is then transformed into numerical features using CountVectorizer, which converts each message into a vector of word frequencies. The data is then split into training and testing sets using train_test_split, with a test size of 20% and a random state of 42 to ensure reproducibility.\r\n\r\nA **Multinomial Naive Bayes** model is then trained on the training data using the fit method, and the accuracy of the model is evaluated on the test data using the score method. The model achieves an accuracy of around 98%, indicating that it is performing well in classifying spam and ham messages.\r\n\r\nFinally, a function named \"result\" is defined that takes a message as input, transforms it using the CountVectorizer, and predicts whether it is spam or not using the trained model. If the prediction is 1, it is classified as spam, and if it is 0, it is classified as ham. The function then prints the corresponding output message.\r\n\r\nOverall, the code provides a simple and effective implementation of a spam email classifier using the \r\n\u003ca href = \"https://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.MultinomialNB.html\" target=\"_blank\"\u003e\r\nMultinomial Naive Bayes algorithm. \u003c/a\u003e It can be easily adapted to other datasets and classification tasks by modifying the preprocessing steps and the choice of machine learning algorithm.\r\n\r\n\r\n\r\n\r\n## 🗃️ Table of Contents \r\n\u003cul\u003e\r\n\u003cli\u003e Getting Started \u003c/li\u003e\r\n\u003cli\u003e Tools \u003c/li\u003e\r\n\u003cli\u003e Resources \u003c/li\u003e\r\n\u003cli\u003e Contributing\u003c/li\u003e\r\n\u003cli\u003e Bug Reports and Feature Requests \u003c/li\u003e\r\n\u003cli\u003e Code of Conduct \u003c/li\u003e\r\n\u003cli\u003e Credits \u003c/li\u003e\r\n\u003cli\u003e License \u003c/li\u003e\r\n\r\n\u003c/ul\u003e\r\n\r\n## ▶️ Getting Started\r\nIf you're new to web development, here are some resources to help you get started:\r\n\r\n\u003cul\u003e\r\n\u003cli\u003e \u003ca href = \"https://www.ibm.com/docs/en/i/7.1?topic=communications-socket-programming\"\u003e IBM : Introduction to Socket Programming \u003c/a\u003e \u003c/li\u003e\r\n\u003cli\u003e \u003ca href=\"https://scikit-learn.org/stable/\" target=\"_top\"\u003e Scikit-Learn : Simple and efficient tools for predictive data analysis  \u003c/a\u003e\u003c/li\u003e \r\n\u003cli\u003e  \u003ca href=\"https://monkeylearn.com/machine-learning/#:~:text=Machine%20learning%20(ML)%20is%20a,to%20make%20their%20own%20predictions.\" target=\"_top\"\u003e MonkeyLearn : What is Machine Learning? \u003c/a\u003e \u003c/li\u003e\r\n\u003c/ul\u003e\r\n\r\n## 🔨 Tools\r\nHere are some tools that can help you streamline your web development workflow:\r\n\u003cul\u003e\r\n\u003cli\u003eJupyter Notebook / Google Colab Notebook - A powerful and customizable code editor.\r\n\u003c/li\u003e\r\n\r\n\u003cli\u003eGit - A version control system for tracking changes in your code\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\r\n## 📖 Resources\r\nHere are some additional resources for web development:\r\n\u003cul\u003e\r\n\u003cli\u003e \u003ca href = \"https://stackoverflow.com/questions/tagged/machine-learning\"\u003e Stack Overflow \u003c/a\u003e : A community-driven Q\u0026A site for programming questions\u003c/li\u003e\r\n\r\n\u003cli\u003e\u003ca href=\"https://machinelearningmastery.com/\" target = \"_blank\"\u003e Machine Learning Mastery \u003c/a\u003e : A website that provides tutorials and courses on various aspects of machine learning, including deep learning, natural language processing, and time series forecasting.\u003c/li\u003e\r\n\u003cli\u003e\u003ca href=\"https://realpython.com/python-sockets/\" target = \"_blank\"\u003e Python Socket Programming Tutorial \u003c/a\u003e:  A tutorial on socket programming in Python, with code examples and explanations. \u003c/li\u003e\r\n\u003cli\u003e\u003ca href=\"https://www.kaggle.com/\" target = \"_blank\"\u003e Kaggle \u003c/a\u003e : A platform that hosts machine learning competitions and provides datasets for practice and learning.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\r\n## 🙌 Contributing\r\n\r\nWe welcome contributions from the community! Here are some guidelines to follow:\r\n\r\n- Please fork the repository and create a new branch for your contribution.\r\n- Make sure to follow the existing code style and conventions.\r\n- Write clear and concise commit messages.\r\n- Submit a pull request with your changes and a description of what you added or fixed.\r\n\r\n## 🐞 Bug Reports and Feature Requests\r\n\r\nIf you find a bug or have a feature request, please open an issue on the project's [issue tracker](https://github.com/example/project/issues) with a detailed description.\r\n\r\n## 🚦 Code of Conduct\r\n\r\nPlease note that this project is released with a [Contributor Code of Conduct](https://github.com/example/project/blob/main/CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.\r\n\r\n## ©️ Credits\r\nThis was created by [Lakshya Singh](https://lakshya-gg.github.io/) . If you have any questions or feedback, please feel free to contact me at @**lakshyasinghwork@gmail.com**.\r\n\r\n\r\n## 📌 License\r\nThis game is licensed under the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html). Please see the [LICENSE.md](https://github.com/Lakshya-GG/Dash-Game/blob/main/LICENSE.md) file for more information.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flakshya-gg%2Fspam-email-classification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flakshya-gg%2Fspam-email-classification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flakshya-gg%2Fspam-email-classification/lists"}