|
1 |
| -# Predicting-Credit-Card-Fraud-with-Logistic-Regression |
2 |
| -This is a codeacademy project from the 'Machine Learning/AI Engineer' path. The project is about predicting credit card fraud using Logistic Regression. |
| 1 | +# Predicting Credit Card Fraud with Logistic Regression |
| 2 | + |
| 3 | +## Overview |
| 4 | +This project, part of Codecademy's **Machine Learning/AI Engineer** path, predicts fraudulent credit card transactions using **Logistic Regression**. |
| 5 | + |
| 6 | +## Dataset & Features |
| 7 | +The dataset (`transactions_modified.csv`) includes transaction details like amount, type, and account balances. Key engineered features: |
| 8 | +- **isPayment**: 1 for DEBIT/PAYMENT, else 0 |
| 9 | +- **isMovement**: 1 for CASH_OUT/TRANSFER, else 0 |
| 10 | +- **accountDiff**: Difference between destination and origin balances |
| 11 | + |
| 12 | +## Model Training |
| 13 | +- **Data Split**: 70% training, 30% test |
| 14 | +- **Scaling**: StandardScaler normalizes features |
| 15 | +- **Classifier**: Logistic Regression |
| 16 | +- **Evaluation**: Model scores printed for training and test sets |
| 17 | + |
| 18 | +## Fraud Prediction |
| 19 | +After training, the model predicts fraud in new transactions: |
| 20 | +```python |
| 21 | +lr.predict(sample_transactions) |
| 22 | +lr.predict_proba(sample_transactions) |
| 23 | +``` |
| 24 | + |
| 25 | +## Running the Code |
| 26 | +Run the script in Python: |
| 27 | +```bash |
| 28 | +python fraud_detection.py |
| 29 | +``` |
| 30 | + |
| 31 | +## Future Improvements |
| 32 | +- Try other ML models (e.g., Random Forest, Neural Networks) |
| 33 | +- Tune hyperparameters |
| 34 | +- Address class imbalance |
| 35 | + |
| 36 | +## Author |
| 37 | +Codecademy Machine Learning/AI Engineer Path |
| 38 | + |
0 commit comments