Detect fraudulent financial transactions using machine learning techniques.
Kaggle Fraud Detection Dataset (~636,262 transactions) with features including:
step: timestep of the transactiontype: type of transaction (PAYMENT, TRANSFER, CASH_OUT, DEPOSIT, etc.)amount: transaction amountnameOrig: sender accountoldbalanceOrg: initial balance of sendernewbalanceOrig: new balance of sendernameDest: receiver accountoldbalanceDest: initial balance of receivernewbalanceDest: new balance of receiverisFraud: target variable (1 if fraud, 0 otherwise)isFlaggedFraud: flagged by the system (not always accurate)
- Python 3.11
- Pandas, NumPy
- Matplotlib, Seaborn
- Scikit-learn (Logistic Regression)
- Streamlit (for app deployment)
balanceDiffOrig= oldbalanceOrg - newbalanceOrigbalanceDiffDest= newbalanceDest - oldbalanceDest- Focus on
TRANSFERandCASH_OUTtransactions
- Logistic Regression with
class_weight='balanced' - Input features: numeric (
amount, balances) + categorical (type) - Preprocessing: StandardScaler for numeric, OneHotEncoder for categorical
- F1-score: 0.82
- Confusion matrix available in notebook
- High precision and recall achieved for fraud class
- Transaction distribution by type
- Fraud rate by transaction type
- Boxplots and histograms for transaction amounts
- Correlation heatmap
- Users input transaction details (type, amount, balances)
- Predicts if transaction is fraudulent
- Displays results with
st.successorst.error
fraud_detection.ipynb→ Jupyter Notebook with analysis and model trainingfraud_detection_pipeline.pkl→ Trained logistic regression pipelinestreamlit_app.py→ Streamlit interface for predictionsscreenshots/→ app screenshots
- Only 0.13% of transactions are fraudulent → highly imbalanced dataset
TRANSFERandCASH_OUTtransactions are most prone to fraud- Feature engineering improves model accuracy
- Logistic Regression is interpretable and effective for baseline predictions