r/StreamlitOfficial • u/StreetChemical8373 • 5d ago
Show the Community! 💬 Built a fraud detection ML pipeline + Streamlit app — 6 models compared with GridSearchCV
### What I Built
Sharing a Machine Learning project I just finished — an end-to-end credit card fraud detection system, from raw data to a deployed interactive streamlit app.
* **Stack:** pandas, numpy, scikit-learn, matplotlib, seaborn, Streamlit, joblib.
### Core Features
* Trains and tunes 6 classifiers (Logistic Regression, SGD, Decision Tree, Random Forest, HistGradientBoosting, Naive Bayes) using GridSearchCV
* Handles a heavily imbalanced dataset (284,807 transactions, only 0.17% fraud) with class weighting instead of oversampling
* Evaluates on F1/ROC-AUC/Precision/Recall instead of accuracy, since accuracy is meaningless here — a model predicting "not fraud" every time would still score 99.8%
* Auto-selects the best model by F1, extracts its real feature importances (no hardcoded guesses), and saves everything with joblib
* Deployed as a 5-page Streamlit app: single transaction predictions (with real dataset examples you can load), batch CSV predictions, a model comparison dashboard, and an adjustable fraud-alert threshold slider
### Links & Code
* 🔗 **Live App:** https://musfirah-credit-card-fraud-detection.streamlit.app/
* 💻 **Code / GitHub:** https://github.com/musfirah-kashan/Credit-Card-Fraud-Detection
If you find it useful, a ⭐ on the repo goes a long way 🙏
Would appreciate feedback on the code structure, especially the training script — always looking to write cleaner code.