Imonikhe Ayeni Back to projects
Machine Learning • Financial Inclusion

Segmenting Credit-Constrained Households with K-Means & PCA

An unsupervised machine learning study that segments credit-constrained households in the 2019 US Survey of Consumer Finances, uncovering two clear risk profiles to guide targeted financial products and inclusion policy.

Python scikit-learn K-Means PCA Azure Databricks Unsupervised ML
0.713Silhouette score
2Household segments
95%Variance kept by PCA
2019SCF survey data

Financial inclusion depends on understanding who is being left out of credit markets, and why. This project uses data-driven segmentation, rather than predetermined rules, to reveal the natural structure hidden inside credit-constrained households.

The problem

A significant share of households face barriers to accessing credit, but "credit-constrained" is not one homogeneous group. Traditional analyses lean on fixed segmentation criteria and risk missing subtler patterns. The goal here was to let the data speak: apply unsupervised learning to the Federal Reserve's 2019 Survey of Consumer Finances (SCF) and discover distinct household segments that call for different products and policy responses.

Approach

The pipeline was built and run on Azure Databricks for scalable, reproducible compute, and combined four analytical stages:

PCA cumulative explained variance curve crossing the 95 percent line at around twelve components
PCA cumulative explained variance: around 12 components retain 95% of the variance.
Elbow method and silhouette analysis charts showing the optimal number of clusters is two
Elbow method and silhouette analysis both point to k = 2 as the optimal number of clusters.

Results

Both validation methods agreed on two clusters. The silhouette score peaked at 0.713 at k = 2, indicating strong, well-separated clusters, before dropping sharply to 0.195 at k = 3. The segmentation was stable across random initialisations and produced reasonably balanced group sizes.

Headline: a silhouette score of 0.713 indicates excellent cluster separation. This is unusually clean structure for household survey data, giving confidence the two segments are real rather than artefacts of the method.

Scatter plot of the two household clusters projected onto the first two principal components, showing clear separation
The two household segments plotted in PCA space (first two principal components), where the clear separation reflects the 0.713 silhouette score.

The two segments

High-risk constrained

  • Higher debt-to-income ratios
  • Lower liquid asset holdings
  • More likely to be turned down for credit
  • Typically younger heads with limited credit history

Moderate-risk constrained

  • Stronger overall financial position
  • Constraint driven mainly by discouraged borrowing
  • Higher incomes but still facing access barriers
  • More established households with complex needs

Why it matters

The two profiles ask for genuinely different responses:

Tools & techniques

Stack

PythonpandasNumPyscikit-learnPySparkMatplotlibSeabornPlotlyAzure DatabricksK-MeansPCASilhouette analysisFeature engineering

Limitations & next steps

The analysis is cross-sectional and reflects 2019 economic conditions, and self-reported survey data carries response bias. Natural extensions include longitudinal panel analysis to track how households move between segments, alternative clustering methods (hierarchical and density-based), and a supervised model to predict segment membership for new households.

Read the full write-up

The complete methodology, annotated code and references are documented in the project repository.

Explore the repository

← Back to all projects