Skip to content

BankPrediction is a machine learning project that predicts customer churn, loan defaults, and detects anomalies using XGBoost models. It includes visual data analysis and a future prediction model for 2033.

License

Notifications You must be signed in to change notification settings

Parham-Dehghan/BankPrediction

Repository files navigation

🏦 BankPrediction

🏅 بج‌ها | Badges

Python
License
Build Status
Downloads

فارسی
خوش اومدی به BankPrediction! یه پروژه جذاب و کاربردی برای پیش‌بینی ریزش مشتری، نکول وام و تشخیص تقلب تو داده‌های بانکی با استفاده از XGBoost و کلی نمودار باحال! 📊 حتی یه بخش ویژه برای پیش‌بینی ریزش مشتری تو سال ۲۰۳۳ هم داریم! 😎

English
Welcome to BankPrediction! A fun and practical project for predicting Customer Churn, Loan Default, and Anomaly Detection in banking data using XGBoost and tons of cool charts! 📊 We even have a special section for predicting churn in 2033! 😎


🔹 درباره پروژه | About the Project

فارسی
این پروژه روی یه دیتاست بانکی به اسم Comprehensive_Banking_Database.csv کار می‌کنه که شامل اطلاعاتی مثل سن مشتری‌ها، موجودی حساب، نوع وام، نوع کارت اعتباری و بازخورد مشتری‌ها می‌شه. ما سه مدل اصلی ساختیم:

  • ریزش مشتری (Churn): شناسایی مشتری‌هایی که احتمالا دیگه از بانک استفاده نمی‌کنن (مثل کسایی که تراکنش قدیمی دارن یا موجودی حساب‌شون منفیه).
  • نکول وام (Loan Default): پیش‌بینی وام‌هایی که ممکنه پرداخت نشن.
  • تشخیص تقلب (Anomaly Detection): پیدا کردن تراکنش‌های مشکوک با استفاده از ستون Anomaly.

ویژگی‌های پروژه:

  • ۲۰ نمودار تحلیلی: توزیع سن، موجودی حساب، نوع حساب، نوع وام، بازخورد مشتری و...
  • ۱۲ نمودار ارزیابی مدل: ماتریس درهم‌ریختگی (Confusion Matrix)، منحنی ROC، Precision-Recall و توزیع احتمالات.
  • پیش‌بینی ۲۰۳۳: شبیه‌سازی ریزش مشتری‌ها برای ۱۰ سال آینده.

English
This project uses a banking dataset (Comprehensive_Banking_Database.csv) containing info like customer age, account balance, loan types, credit card types, and customer feedback. We built three main models:

  • Customer Churn: Identifies customers likely to stop using the bank (e.g., those with old transactions or negative balances).
  • Loan Default: Predicts loans that may not be repaid.
  • Anomaly Detection: Detects suspicious transactions using the Anomaly column.

Project Features:

  • 20 Exploratory Charts: Age distribution, account balance, account type, loan type, customer feedback, etc.
  • 12 Model Evaluation Charts: Confusion Matrix, ROC Curve, Precision-Recall, and probability distributions.
  • 2033 Prediction: Simulates customer churn 10 years into the future.

🛠 پیش‌نیازها | Requirements

فارسی
برای اجرای پروژه به این پکیج‌ها نیاز داری:

pip install pandas numpy scikit-learn xgboost matplotlib seaborn

English
To run the project, you need these packages:

pip install pandas numpy scikit-learn xgboost matplotlib seaborn

▶ نحوه اجرا | How to Run

فارسی

  1. فایل Comprehensive_Banking_Database.csv رو تو همون پوشه‌ای که فایل bank_prediction.ipynb هست قرار بده.
  2. Jupyter Notebook رو باز کن.
  3. سلول‌ها رو یکی‌یکی با زدن Shift + Enter اجرا کن.
  4. خروجی‌ها شامل نمودارها، گزارش‌های مدل و پیش‌بینی‌هاست.

English

  1. Place Comprehensive_Banking_Database.csv in the same directory as bank_prediction.ipynb.
  2. Open Jupyter Notebook.
  3. Run each cell with Shift + Enter.
  4. Check the outputs, including charts, model reports, and predictions.

📊 خروجی‌ها | Outputs

فارسی

  • ۲۰ نمودار تحلیلی: برای بررسی توزیع سن، موجودی حساب، نوع وام، نوع کارت اعتباری، بازخورد مشتری و...
  • ۱۲ نمودار ارزیابی مدل: شامل ماتریس درهم‌ریختگی، منحنی ROC، Precision-Recall و توزیع احتمالات برای هر هدف.
  • پیش‌بینی ۲۰۳۳: توزیع احتمالات ریزش مشتری‌ها برای سال ۲۰۳۳.
  • گزارش مدل‌ها: دقت (Accuracy)، ROC AUC و گزارش طبقه‌بندی (Classification Report).

English

  • 20 Exploratory Charts: Age, account balance, account type, loan type, credit card type, customer feedback, etc.
  • 12 Model Evaluation Charts: Confusion Matrix, ROC, Precision-Recall, and probability distributions for each target.
  • 2033 Prediction: Churn probability distribution for 2033.
  • Model Reports: Accuracy, ROC AUC, and Classification Report.

⚠ نکات مهم | Important Notes

فارسی

  • داده‌های نامتوازن: ستون Anomaly خیلی نامتوازنه (99.34% مقدار ۱). ما از scale_pos_weight استفاده کردیم، ولی می‌تونی روش‌های دیگه مثل SMOTE رو هم امتحان کنی.
  • دقت بالای مدل Churn: این مدل ۱۰۰٪ دقت داره که ممکنه نشونه Overfitting باشه. پیشنهاد می‌کنم داده‌ها رو بیشتر بررسی کنی.
  • پیش‌بینی ۲۰۳۳: فقط ویژگی‌های زمانی آپدیت شدن. اگه سناریوی خاصی مدنظرت هست، بگو تا اضافه کنیم!

English

  • Imbalanced Data: The Anomaly column is highly imbalanced (99.34% value 1). We used scale_pos_weight, but you could try methods like SMOTE.
  • High Churn Accuracy: The Churn model has 100% accuracy, which may indicate overfitting. Consider further data validation.
  • 2033 Prediction: Only time-based features were updated. Let me know if you want specific scenarios added!

🤝 چطور مشارکت کنی؟ | How to Contribute

فارسی

  1. پروژه رو تو GitHub Fork کن.
  2. تغییراتت رو تو یه شاخه جدید اعمال کن.
  3. یه Pull Request بفرست و توضیح بده چی اضافه کردی.

English

  1. Fork the repository on GitHub.
  2. Make changes in a new branch.
  3. Submit a Pull Request with your updates.

👤 درباره من | About Me

فارسی
این پروژه توسط پرهام دهقان ساخته شده. اگه سوال یا پیشنهادی داری، تو GitHub باهام تماس بگیر یا یه Issue باز کن! 😊

English
Created by Parham Dehghan. Have questions or suggestions? Reach out on GitHub or open an Issue! 😊


💡 پیشنهادات برای بهتر شدن | Suggestions for Improvement

فارسی

  • می‌تونی از SMOTE یا روش‌های دیگه برای بالانس کردن داده‌های Anomaly استفاده کنی.
  • برای مدل Churn یه کم Regularization (مثل L1 یا L2) به XGBoost اضافه کن تا از Overfitting جلوگیری بشه.
  • برای پیش‌بینی ۲۰۳۳ می‌تونی سناریوهای پیچیده‌تر مثل تغییرات اقتصادی یا رفتار مشتری اضافه کنی.

English

  • Try SMOTE or other methods to balance the Anomaly data.
  • Add Regularization (e.g., L1 or L2) to the Churn model to prevent overfitting.
  • For 2033 predictions, consider adding complex scenarios like economic changes or customer behavior shifts.


BankPrediction یه پروژه باحال برای یادگیری ماشین و تحلیل داده‌های بانکیه. امیدوارم لذت ببری! 🚀
BankPrediction is a cool project for machine learning and banking data analysis. Hope you enjoy it! 🚀

About

BankPrediction is a machine learning project that predicts customer churn, loan defaults, and detects anomalies using XGBoost models. It includes visual data analysis and a future prediction model for 2033.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published