Week 8 Due Fri, midnight (Week 8)

PC Lab 7 — Bank Customers Segmentation

A bank squeezed by FinTech competition hires you as a consultant: segment its credit-card customers with K-means, find the optimal number of clusters, and tell marketing exactly whom to target.

Week 8 materials
Solution
Published after the deadline

The setting

A traditional bank is bleeding customers to FinTech apps, and it has hired you as a consultant. What it does have is data: six months of detailed behavior for thousands of credit-card customers.

“We’re launching a marketing campaign, but we can’t talk to everyone the same way. Split our customers into at least three groups that actually mean something — and tell us which group to spend the budget on.”

Your goals: exploratory analysis on real customer data, clustering (with a defensible choice of k), and translating statistical clusters into customer segments a marketing department can use. This is unsupervised learning: no labels, no right answer — your interpretation is the deliverable.

Background

This week’s lecture, Banking in the Age of AI, frames the business problem. Toolkit: StandardScaler, K-means, the Elbow method, and optionally PCA and autoencoders for dimensionality reduction.

The data

BankCustomersData_PCLab7.csv — one row per customer, 18 variables of credit-card behavior: balances, purchases (one-off vs. installments), cash advances, frequencies (scored 0–1), credit limit, payments, tenure. The assignment PDF has a full glossary of every column.

Your assignment

Part 1 — Know your sample (Task 1)

  • Import the data and check for missing values — fill the gaps in MINIMUM_PAYMENTS and CREDIT_LIMIT with the mean; check for duplicates.
  • What is the average credit limit?
  • Correlations and distributions of key variables — show only what’s interesting.

Part 2 — How many groups? (Task 2)

  • Scale the data first (StandardScaler — clustering on raw dollars vs. 0–1 frequencies is meaningless).
  • Draw the Elbow curve to choose the number of clusters. Real elbows are rarely textbook-clean: defend your choice.

Part 3 — Segment and interpret (Task 2, cont.)

  • Run K-means with your chosen k and describe each cluster. Does it make sense as a customer type?
  • The bank wants to focus on high-spending customers who use the card as a loan: which cluster gets the marketing budget?
  • Find a smart way to summarize and plot the segmentation — one chart the board would understand.

Part 4 — Reduce the dimensions (Task 3 — optional)

  • Apply PCA (2 components) or an autoencoder and look at your customers in the reduced space.
  • Does it change your view on the right number of clusters? Can you improve the segmentation?

Deliverables

Grading

  1. Submitting before the deadline;
  2. Code quality — comments, readability, use of functions;
  3. Notebook structure — well organized, explain what and why;
  4. Completing the tasks and innovating — produce less, but more useful output.

Model solution

A complete model solution — code, output, charts, and commentary — will be published on this page after the submission deadline.

Stuck, or curious about something here? Ask on the course forum →