Detecting credit card fraud using machine learning and real financial data
CreditCardGuard is a machine learning project that leverages real-world credit card transaction data to detect fraudulent activities. Using advanced classification algorithms and data preprocessing techniques, the system achieves high accuracy in identifying suspicious transactions while minimizing false positives.
284,807 records
30 PCA-transformed + Amount + Class
99.83% Normal, 0.17% Fraud
Model | Accuracy | Precision | Recall | F1 Score |
---|---|---|---|---|
Logistic Regression | 0.999 | 0.887 | 0.604 | 0.719 |
Decision Tree | 0.999 | 0.686 | 0.769 | 0.725 |
import joblib
# Load the trained model
model = joblib.load('creditcard_model.joblib')
# Prepare transaction data (after preprocessing)
transaction = preprocess_transaction(raw_data)
# Get prediction
prediction = model.predict(transaction)
probability = model.predict_proba(transaction)
if prediction[0] == 1:
print(f"Fraud detected! Confidence: {probability[0][1]:.2f}")
Implement a real-time transaction monitoring system with immediate fraud alerts
Develop a Flask/Streamlit frontend for easy model interaction
Add email/SMS alerts for suspicious transactions