Introduction
Healthcare organizations collect enormous amounts of data on the consumer experience, but much of it is still analyzed using simple averages and summary reports.
One of the most valuable sources of consumer feedback is the Consumer Assessment of Healthcare Providers and Systems (CAHPS) survey. Used by Medicaid managed care organizations, Medicare Advantage plans, and other health care programs, CAHPS measures members’ experiences with their health plans, providers, customer service, and access to care.
Most organizations create dashboards that answer questions like:
What is our average overall rating?
How many members completed the survey?
Which county has the highest satisfaction score?
While these metrics are useful, they rarely answer a more important question:
Do different member groups have different health care needs?
For example, two members may rate their health plan a “7,” but for completely different reasons.
One may feel satisfied with clinical care but frustrated with customer service.
Another may have difficulty finding in-network providers.
A third may simply need more information about available benefits.
If we treat all members equally, outreach campaigns become less effective.
Instead, we can use machine learning to identify natural groups of consumers and tailor communication based on their characteristics.
In this tutorial, we’ll create a simple consumer segmentation pipeline using Python clustering, Scikit-learn, and K-Means and then prepare the results for visualization in Tableau.
Healthcare organizations spend significant resources reaching their members:
Preventive care reminders
Renewal notices
Wellness campaigns
Care management
Customer service monitoring.
However, sending identical communications to all members rarely produces the best results.
Consumer segmentation allows organizations to answer questions such as:
Which members are highly engaged?
Which members require additional education?
Which members frequently contact customer service?
What populations can benefit from care management?
Instead of creating one campaign for everyone, organizations can create personalized engagement strategies for each consumer segment.
For this example, we will use a simplified CAHPS style data set.
import pandas as pd
df = pd.DataFrame({
"Member_ID":(1001,1002,1003,1004,1005,1006,1007,1008,1009,1010),
"Age":(26,58,44,67,31,52,61,37,49,29),
"Overall_Rating":(10,6,8,5,9,7,6,9,8,10),
"Provider_Communication":(10,5,9,4,9,7,5,8,8,10),
"Customer_Service":(9,4,8,3,8,6,4,8,7,9),
"Access_To_Care":(9,5,8,4,9,7,5,8,7,9),
"Portal_Logins":(18,2,10,1,15,5,2,12,8,20),
"Call_Center_Contacts":(1,7,3,8,1,4,6,2,3,1)
})
Each row represents a Medicaid member who completed a CAHPS survey.
Our variables include:
| Variable | Description |
|---|---|
| Age | Member Age |
| Overall_Rating | Overall health plan rating (0 to 10) |
| Provider_Communication | Satisfaction with suppliers |
| customer_service | Satisfaction with customer service. |
| Access_to_care | Ease of obtaining medical care. |
| Portal_Logins | Number of member portal logins |
| Call_center_contacts | Number of customer service interactions |
Although simplified, these variables resemble the types of data that healthcare analysts typically work with.
Before building any machine learning model, we need to understand the data set.
print(df.info())
print(df.describe())
Check for missing values.
print(df.isnull().sum())
Healthcare survey data sets often contain unanswered questions or incomplete responses.
A common strategy is to replace missing values using the median.
from sklearn.impute import SimpleImputer
imputer = SimpleImputer(strategy="median")
numeric_columns = df.columns.drop("Member_ID")
df(numeric_columns) = imputer.fit_transform(df(numeric_columns))
Machine learning algorithms work best when variables are on similar scales.
For example:
The age ranges between 18 and 90 years.
Portal logins can range from 0 to 50.
Survey scores range from 0 to 10.
Without normalization, variables with larger values dominate the grouping process.
from sklearn.preprocessing import StandardScaler
features = (
"Age",
"Overall_Rating",
"Provider_Communication",
"Customer_Service",
"Access_To_Care",
"Portal_Logins",
"Call_Center_Contacts"
)
X = df(features)
scaler = StandardScaler()
X_scaled = scaler.fit_transform(X)
One challenge with K-Means is deciding how many clusters to create.
A common approach is the elbow method.
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
inertia = ()
for k in range(1,8):
model = KMeans(
n_clusters=k,
random_state=42,
n_init=10
)
model.fit(X_scaled)
inertia.append(model.inertia_)
plt.plot(range(1,8), inertia, marker="o")
plt.xlabel("Number of Clusters")
plt.ylabel("Within Cluster Sum of Squares")
plt.title("Elbow Method")
plt.show()
The point where the curve begins to flatten suggests an appropriate number of clusters.
For this tutorial, we will use four clusters.
kmeans = KMeans(
n_clusters=4,
random_state=42,
n_init=10
)
df("Cluster") = kmeans.fit_predict(X_scaled)
Each member now belongs to one of four consumer segments.
View tasks.
print(
df(
("Member_ID","Cluster")
)
)
Group numbers alone have little meaning.
Let’s calculate the average characteristics of each group.
cluster_summary = df.groupby("Cluster")(features).mean()
print(cluster_summary.round(2))
Example interpretation:
Group 0: Digital Champions
Frequent use of the portal
High satisfaction
He rarely communicates with customer service.
Recommended strategy:
Wellness campaigns
Preventive care reminders
Mobile app improvements
Group 1: Care Coordination Members
Older population
Lowest supplier communication scores
Increased health care utilization
Recommended strategy:
Care management
Support for chronic diseases
Supplier Navigation
Group 2: High Support Members
Low satisfaction
Frequent call center contacts
Lower scores on access to care
Recommended strategy:
Proactive customer service
Case management
Member Defense
Group 3: Moderate Participation Members
Average satisfaction
Moderate digital engagement
Occasional customer service interactions.
Recommended strategy:
Charitable education
Annual wellness reminders
Digital participation campaigns
Business users rarely think in terms of “Cluster 0” or “Cluster 2.”
Instead, turn groups into descriptive personas.
persona = {
0:"Digital Champions",
1:"Care Coordination",
2:"High Support",
3:"Moderate Engagement"
}
df("Persona") = df("Cluster").map(persona)
Now each member belongs to an easily understandable segment.
Export the rich data set.
df.to_csv(
"Consumer_Segmentation.csv",
index=False
)
Tableau can now connect directly to this file.
Recommended panel layout:
Panel 1: Consumer Overview
KPIs
Total members
Number of groups
Average Overall Rating
Average portal logins
Panel 2: Consumer Personas
Views
Cluster distribution (bar chart)
People Breakdown (Pie Chart)
Average satisfaction per person
Average portal usage per person
Panel 3: Geographic analysis
Maps
Consumer Person by County
Average satisfaction by region
Call Center Contacts by County
Panel 4: Participation Analysis
Graphics
Portal logins vs. overall rating
Call Center Contacts vs Satisfaction
Supplier communication per person
With Tableau filters, users can explore:
age group
County
Language
Health plan
Consumer Persona
This allows business users to identify trends without writing SQL or Python.
The goal of clustering is not simply to create groups, but to improve decision making.
Instead of sending identical communications to all Medicaid members, organizations can tailor communication based on consumers’ needs.
For example:
| Person | Recommended range |
|---|---|
| Digital Champions | Wellness programs, preventive care reminders. |
| Care coordination | Support for chronic conditions, provider navigation |
| High support | Customer service monitoring, case management. |
| Moderate commitment | Benefits education, annual renewal reminders |
This transforms survey data into actionable insights for consumers.
CAHPS survey data contains much more than satisfaction scores. Combined with machine learning, it can reveal significant patterns in consumer behavior that traditional panels often miss.
In this tutorial, we use Python to clean and prepare survey data, standardize variables, apply K-Means clustering to identify consumer segments, interpret those segments as business personas, and export the results for visualization in Tableau.
The same workflow can be extended to larger healthcare data sets by incorporating enrollment information, demographic characteristics, healthcare utilization, and digital engagement metrics. As healthcare organizations continue to embrace data-driven decision making, consumer segmentation provides a practical way to go beyond descriptive reporting and deliver more personalized, member-focused experiences.





