{"id":50429018,"url":"https://github.com/steviecurran/fraud-detection-ml","last_synced_at":"2026-05-31T12:30:55.916Z","repository":{"id":345382054,"uuid":"1185687379","full_name":"steviecurran/fraud-detection-ml","owner":"steviecurran","description":"Fraud Detection with Machine Learning","archived":false,"fork":false,"pushed_at":"2026-03-18T23:28:20.000Z","size":11922,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-19T10:31:30.983Z","etag":null,"topics":["ab-testing","confusionmatrix","fraud-detection","imbalanced-data","machine-learning","matplotlib","pandas","python","recall-precision","skit-learn"],"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/steviecurran.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-18T21:01:24.000Z","updated_at":"2026-03-18T23:28:24.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/steviecurran/fraud-detection-ml","commit_stats":null,"previous_names":["steviecurran/fraud-detection-ml"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/steviecurran/fraud-detection-ml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steviecurran%2Ffraud-detection-ml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steviecurran%2Ffraud-detection-ml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steviecurran%2Ffraud-detection-ml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steviecurran%2Ffraud-detection-ml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steviecurran","download_url":"https://codeload.github.com/steviecurran/fraud-detection-ml/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steviecurran%2Ffraud-detection-ml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33731998,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"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":["ab-testing","confusionmatrix","fraud-detection","imbalanced-data","machine-learning","matplotlib","pandas","python","recall-precision","skit-learn"],"created_at":"2026-05-31T12:30:55.837Z","updated_at":"2026-05-31T12:30:55.906Z","avatar_url":"https://github.com/steviecurran.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Fraud Detection with Machine Learning ##\n\n**Overview**\n\nThis project builds a machine learning model to detect fraudulent transactions in a highly imbalanced dataset.\n\nThe focus is on practical model performance — balancing fraud detection (recall) with minimising false alarms (precision), rather than maximising raw accuracy.\n\n**Key Results**\n  - Precision: 0.74\n  - Recall: 0.57\n  - F1 Score: 0.65\n  - Alert Rate: 0.6%\n\nThis means:\n  - ~3 in 4 flagged transactions are genuine fraud\n  -  ~57% of fraud cases are successfully detected\n  - Only 0.6% of all transactions are flagged for review\n\n**Problem Characteristics**\n\nFraud detection is a *highly imbalanced classification problem:*\n  - Fraud cases are rare\n  -  Standard accuracy is misleading\n  - False positives carry operational cost\n\n**Approach**\n\n- Data Processing\n  - Removed non-informative identifier column\n  - Defined target variable (target_ml) as fraud (positive class)\n  - Train/test split performed before resampling\n\n- Handling Class Imbalance\n  - Applied undersampling, oversampling (SMOTE) and class weighting to training data only\n  - Prevented data leakage by keeping test data untouched\n\n- Classifiers Evaluated\n  - Random Forest Classifier\n  - Logistic Regreesion\n  - Support Vector\n  - Gradient Boosting (XGBoost)\n\n- Model Selection\n  - Models evaluated using:\n  - Precision\n  - Recall\n  - F1 Score\n\n- Threshold tuning used instead of default 0.5 cutoff\n\n**Threshold Optimisation**\n\nRather than using a fixed threshold, the model output probabilities were tuned to optimise performance.\nThe optimal threshold (~0.91) was selected to:\n  - Maximise F1 score\n  - Maintain a low alert rate\n  - Keep precision high for operational usability\n\n**Evaluation**\n\nConfusion Matrix (Final Model)\n\n | | **Predicted Legit**| **Predicted Fraud** | \n  | :---    | :--  | :---   | \n   |**Actual Legit** |\t41061  | 69| \n | **Actual Fraud**|\t150\t|   200| \n\n ![](https://raw.githubusercontent.com/steviecurran/fraud-detection-ml/refs/heads/main/results.png)\n  \n**Interpretation**\n  - High precision → low false alarm rate\n  -  Moderate recall → some fraud remains undetected\n  - Suitable for real-world triage systems\n\nNote: Due to class imbalance, the normalized confusion matrix shows near-perfect true negatives. This reflects dataset composition rather than perfect model performance.\n\n![](https://raw.githubusercontent.com/steviecurran/fraud-detection-ml/refs/heads/main/metrics.png)\n\n**Key Insight**\n\nThis project demonstrates that *model performance in real-world ML is about trade-offs, not perfection*\n\nA useful fraud model must:\n  - Catch enough fraud (recall)\n  - Avoid overwhelming analysts (precision)\n  - Operate at a realistic alert rate\n\n**Technologies Used**\n  - Python\n  - scikit-learn\n  - imbalanced-learn \n  - pandas / numpy\n  - matplotlib\n\n**Future Improvements**\n-  Cost-sensitive learning (fraud vs investigation cost)\n-  Feature engineering / domain features\n-  Model calibration\n-  Deployment as a scoring pipeline\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteviecurran%2Ffraud-detection-ml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteviecurran%2Ffraud-detection-ml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteviecurran%2Ffraud-detection-ml/lists"}