{"id":23583918,"url":"https://github.com/rickydoan/ml-email-spam_classification","last_synced_at":"2025-11-02T23:30:37.017Z","repository":{"id":269315656,"uuid":"906978456","full_name":"RickyDoan/ML-Email-Spam_Classification","owner":"RickyDoan","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-23T10:28:43.000Z","size":966,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-27T02:18:19.523Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/RickyDoan.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-12-22T13:29:50.000Z","updated_at":"2024-12-24T08:13:42.000Z","dependencies_parsed_at":"2024-12-23T11:29:32.871Z","dependency_job_id":null,"html_url":"https://github.com/RickyDoan/ML-Email-Spam_Classification","commit_stats":null,"previous_names":["rickydoan/email-spam_classification-redo","rickydoan/email-spam_classification","rickydoan/ml-email-spam_classification"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RickyDoan%2FML-Email-Spam_Classification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RickyDoan%2FML-Email-Spam_Classification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RickyDoan%2FML-Email-Spam_Classification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RickyDoan%2FML-Email-Spam_Classification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RickyDoan","download_url":"https://codeload.github.com/RickyDoan/ML-Email-Spam_Classification/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239403484,"owners_count":19632596,"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":[],"created_at":"2024-12-27T02:18:22.132Z","updated_at":"2025-11-02T23:30:36.976Z","avatar_url":"https://github.com/RickyDoan.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Email Spam Classification with Machine Learning\n* Play with app : https://ricky-email-spam-classification.streamlit.app/\n* This project demonstrates how to build a machine learning model for classifying emails as spam or not spam. The model is trained using natural language processing (NLP) techniques and machine learning algorithms to identify spam emails accurately.\n\n### 1/ Libraries Used\n* Stopwords: For removing common words that don't add much meaning to the text (e.g., \"and\", \"the\").\n* Tokenize: To split the text into individual words (tokens).\n* String: For removing punctuation and unnecessary characters.\n* CountVectorizer: Converts text data into a matrix of token counts.\n* TfidfVectorizer: Converts text data into a matrix of Term Frequency-Inverse Document Frequency (TF-IDF) values.\n* Scikit-learn: Used for building and evaluating machine learning models.\n### 2/ Project Steps\n#### Data Preprocessing:\n\n* Cleaned and preprocessed email text data by removing stop words, punctuation, and tokenizing the text.\nVectorization:\n\n* Used CountVectorizer and TfidfVectorizer to convert text into numerical features.\nModel Training:\n\n* Trained a classification model such as : MultinomialNB, GaussianNB, Xgboost, RandomizeSearchCV, Optuna to predict whether an email is spam or not.\n* Focused on optimizing the Recall metric to reduce false negatives (missed spam emails).\n### 3/ Evaluation:\n* Evaluated the model's performance using precision, recall, and accuracy metrics:\n* The accuracy is 96% with 100% recall for kaggle datasets.\n* According to real world spam, the accuracy is around 70% because the data was trained from my datasets has still not updated, so that some new kind of spam email was not detected.\n* Datasets from kaggle : https://www.kaggle.com/datasets/uciml/sms-spam-collection-dataset\n### 4/ Results\nThe model can effectively classify emails as spam or not, with a focus on minimizing false negatives.\nThe use of CountVectorizer and TfidfVectorizer significantly improved the model's performance.\n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickydoan%2Fml-email-spam_classification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frickydoan%2Fml-email-spam_classification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickydoan%2Fml-email-spam_classification/lists"}