Data ScienceClustering, reduction and recommendations

Decide when rules are better than unsupervised learning

PK
Pankit Kumar
Sr. Data Scientist at Parexel (a Goldman Sachs–backed company) · 20 September 2026 · 2 min read
Technically reviewed by Ishaan Sharma
In this article (3 sections)

Clustering is useful for exploration when the structure is unknown. If the intended action already depends on clear thresholds, explicit rules can be easier to explain, test and govern. Complexity should solve a documented failure, not signal sophistication.

Compare two partitions on the same fixture

Our synthetic customer rule assigns:

  • premium when average order exceeds 80;
  • otherwise returns when return rate exceeds 0.12; and
  • routine otherwise.

It covers all 360 rows: 120 premium, 125 returns and 115 routine. Three-cluster K-means uses standardized visits, average order and return rate. After mapping each cluster to its majority rule label, descriptive purity is 98.61%.

The high agreement is expected because the fixture has separated behaviour profiles. It does not prove that either partition improves outcomes.

python
from unsupervised_cases import rules_case

r = rules_case()
assert r['rows'] == 360
assert r['rule_unassigned'] == 0
assert sum(r['rule_counts'].values()) == 360
assert r['cluster_rule_purity_after_best_column_labels'] > .98
print(r)

Run it in the unsupervised lab. The comparison makes action thresholds visible and keeps cluster fit independent of rule labels.

Prefer rules when their assumptions are the product

Rules work well when policy is explicit, data is limited, auditability is critical and boundaries have domain meaning. They support deterministic tests and stable versioning. Their weaknesses include brittle thresholds, sharp boundary effects and growing exception logic.

Unsupervised learning can reveal patterns across several features and generate hypotheses. It introduces feature scaling, cluster count, stability, label alignment and profile interpretation. If a cluster merely reconstructs an existing rule, the extra maintenance may not be worthwhile.

Compare both systems on downstream validation: coverage, action cost, stability, segment size and measured treatment response. Add a simple rule baseline before clustering. Prefer the simpler system when outcomes and operational fit are equivalent within meaningful uncertainty.

A hybrid can use rules for hard eligibility and clustering for exploration within eligible rows. Keep the layers separate so an exploratory model cannot silently override policy.

Exercise: perturb features around both rule thresholds and measure assignment flips. Compare with cluster-boundary flips under resampling. Write a decision record choosing one approach based on action, risk, maintenance and evidence rather than internal clustering score.

NeuraPath's Data Science course treats rules as a serious baseline. Unsupervised learning earns adoption when it produces stable, validated value beyond transparent policy.

Continue learning

This article is part of the Clustering, reduction and recommendations sequence. Use the neighbouring tasks when you need the prerequisite or the next application.

PK
Pankit Kumar
Lead Instructor, NeuraPath Academy

Pankit Kumar has 10 years in Data Science & AI, building and shipping production systems in regulated pharma and clinical environments. He is a freelance trainer at Boston Institute of Analytics, AnalytixLabs and Scaler, and has taught this material to thousands of working professionals.

This article is part of our Data Science programme — 6 months. From data foundations to machine learning, deep learning and deployment.

Explore Data Science
Counselling is free · no obligation

Not sure which programme fits?

Tell us your background and we will map it to the right entry point — including saying so when a cheaper programme is the better fit. A counsellor replies within one working day.