{"id":28679306,"url":"https://github.com/dpb24/fake-news-detector","last_synced_at":"2026-04-27T18:32:48.404Z","repository":{"id":296876844,"uuid":"994850344","full_name":"dpb24/fake-news-detector","owner":"dpb24","description":" 📰 NLP: Fake News Detection using Classical Machine Learning","archived":false,"fork":false,"pushed_at":"2025-06-03T09:31:39.000Z","size":2099,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-14T01:09:20.075Z","etag":null,"topics":["bag-of-words","decision-tree","decision-tree-classifier","fake-news","feature-engineering","feature-extraction","machine-learning","matplotlib","natural-language-processing","nlp","nlp-machine-learning","predictive-analytics","predictive-modeling","scikit-learn","text","vectorization","visual-studio-code","xgboost","xgboost-classifier","xgboost-model"],"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/dpb24.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,"zenodo":null}},"created_at":"2025-06-02T15:18:51.000Z","updated_at":"2025-06-03T09:31:40.000Z","dependencies_parsed_at":"2025-06-03T04:40:24.013Z","dependency_job_id":null,"html_url":"https://github.com/dpb24/fake-news-detector","commit_stats":null,"previous_names":["dpb24/fake-news-detector"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dpb24/fake-news-detector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpb24%2Ffake-news-detector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpb24%2Ffake-news-detector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpb24%2Ffake-news-detector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpb24%2Ffake-news-detector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dpb24","download_url":"https://codeload.github.com/dpb24/fake-news-detector/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpb24%2Ffake-news-detector/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32349560,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T17:12:42.749Z","status":"ssl_error","status_checked_at":"2026-04-27T17:12:41.658Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["bag-of-words","decision-tree","decision-tree-classifier","fake-news","feature-engineering","feature-extraction","machine-learning","matplotlib","natural-language-processing","nlp","nlp-machine-learning","predictive-analytics","predictive-modeling","scikit-learn","text","vectorization","visual-studio-code","xgboost","xgboost-classifier","xgboost-model"],"created_at":"2025-06-14T01:09:10.257Z","updated_at":"2026-04-27T18:32:48.400Z","avatar_url":"https://github.com/dpb24.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📰 Fake News Detector: Binary Classification Model \u003cbr\u003e\n\n**Libraries:** `scikit-learn`, `XGBoost`, `matplotlib`, `pandas`, `numpy` \u003cbr\u003e\n**Dataset:** [ISOT Fake News Detection Dataset](https://onlineacademiccommunity.uvic.ca/isot/2022/11/27/fake-news-detection-datasets/) \u003cbr\u003e\n\nIn this project we use the 🐍 Python libraries [scikit-learn](https://scikit-learn.org/stable/) and [XGBoost](https://xgboost.readthedocs.io/en/stable/) to build a machine learning model that classifies news articles as fake or real. We combine classical machine learning techniques with engineered textual features to improve model generalisability and performance. \u003cbr\u003e\n\n## 🧠 Approach\n - **Text vectorisation:** Bag of Words (BoW)\n - **Feature engineering:** % of special characters \u0026 % of capitalised characters\n - **Baseline model:** `DecisionTreeClassifier` with `GridSearchCV`\n - **Ensemble model:** `XGBClassifier` with `RandomizedSearchCV`\n - **Robustness:** Removed dataset-specific artefacts (eg. *reuters*) from BoW to improve generalisability \u003cbr\u003e\n\n## ✅ Results\n - 🤖 **XGBoost ensemble** achieved **~99.8%** accuracy, precision, recall, and F1 score\n - **Top feature:** `headline_capitalised` (engineered)\n - **Fun insight:** second most important vectorized word for classification — \"Trump\" 🇺🇸\n\n## 🔭 Future Work\n - Test on more diverse, real-world datasets\n - Experiment with advanced text vectorisation (eg. word embeddings, transformer models)\n - Compare with alternative classifiers (eg. Support Vector Machines) \u003cbr\u003e\n\n📖 Jupyter Notebook: [GitHub](https://github.com/dpb24/fake-news-detector/blob/main/notebooks/Fake_News_Detector.ipynb) | [CoLab](https://colab.research.google.com/drive/1WacZBouhz3WlujSIORFhSaVje6W5upGZ?usp=sharing) | [Kaggle](https://www.kaggle.com/code/davidpbriggs/fake-news-detector) \u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"visuals/distribution of uppercase characters.png\" width=\"800\"/\u003e\n    \u003cimg src=\"visuals/xgboost - feature importance.png\" width=\"800\"/\u003e\n    \u003cimg src=\"visuals/xgboost - confusion matrix.png\" width=\"800\"/\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdpb24%2Ffake-news-detector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdpb24%2Ffake-news-detector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdpb24%2Ffake-news-detector/lists"}