Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BNPL Checkout Risk & Repayment Behavior Analysis

Predicting repayment risk in "Buy Now, Pay Later" (BNPL) transactions using EDA, statistical testing, and machine learning — built as a lightweight risk-screening solution e-commerce platforms could use to offer BNPL safely, without an in-house risk team.

🔗 Links

Project Overview

This project analyzes 50,000 synthetic BNPL transactions to answer one question: can transaction and customer data help identify which BNPL transactions are more likely to become at-risk?

The workflow covers:

  1. Data preparation — cleaning, target variable creation (at_risk)
  2. EDA & Hypothesis Testing — identifying and statistically confirming key risk drivers
  3. Tableau Dashboard — a self-serve BI tool for non-technical teams to monitor risk patterns
  4. Machine Learning — classification models to predict at-risk transactions
  5. Streamlit App — a live demo simulating a real-time checkout risk check

Key Findings

  • Credit score and VPN connection type are the two statistically significant drivers of repayment risk (all other variables tested — gender, device type, browser, purchase category, income, purchase amount — showed no meaningful association).
  • At-risk customers had a significantly lower average credit score (500.6) than non-at-risk customers (595.6).
  • VPN connections showed a 43.5% at-risk rate, compared to ~21% for WiFi/4G-5G.
  • A tuned Random Forest model (threshold = 0.40) was the best-performing classifier, reaching 80% Recall — prioritizing catching at-risk customers, the costliest error for a BNPL provider to miss.

Repository Contents

File Description
bnpl_analysis.ipynb Full analysis notebook — data cleaning, EDA, hypothesis testing, ML modeling, model evaluation
app.py Streamlit app simulating a real-time BNPL risk check at checkout
rf_model.pkl Trained, tuned Random Forest model (used by app.py)
encoder.pkl Fitted OneHotEncoder for categorical features (used by app.py)
README.md This file

Running the Streamlit App Locally

The app is not deployed — it's designed to run on your own machine. To try it:

  1. Clone this repository:

    git clone https://github.com/fran26m/bnpl-risk-project.git
    cd bnpl-risk-project
  2. Install the required packages:

    pip install streamlit pandas scikit-learn
  3. Run the app:

    streamlit run app.py
  4. The app will open automatically in your browser at localhost:8501.

Note: app.py loads rf_model.pkl and encoder.pkl from the same folder — make sure all three files stay together in the repo root.

Tech Stack

  • Python: pandas, scikit-learn, matplotlib, seaborn, scipy, statsmodels
  • Visualization / BI: Tableau
  • Web App: Streamlit
  • Environment: Jupyter Notebook (Anaconda)

Author

Juan Francisco Orona — Ironhack Data Analytics Bootcamp

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages