Customer Segmentation with Clustering
Clustering is a powerful technique in marketing analytics that helps you discover natural groupings within your customer base. Instead of relying on predefined categories, clustering uses data to reveal segments of customers who share similar behaviors or demographic features. This approach is especially valuable when you want to identify distinct customer segments for more personalized marketing strategies.
12345678910111213141516171819202122import pandas as pd from sklearn.cluster import KMeans # Sample customer data with features: Age, Annual Income (k$), Spending Score (1-100) data = { "CustomerID": [1, 2, 3, 4, 5, 6], "Age": [23, 45, 31, 35, 52, 40], "AnnualIncome": [15, 40, 25, 60, 80, 55], "SpendingScore": [39, 81, 6, 77, 40, 76] } df = pd.DataFrame(data) # Select features for clustering X = df[["Age", "AnnualIncome", "SpendingScore"]] # Create and fit KMeans model kmeans = KMeans(n_clusters=2, random_state=42) kmeans.fit(X) # Output cluster centers print("Cluster Centers:") print(kmeans.cluster_centers_)
Clusters are formed when the algorithm groups customers based on the similarity of their features, such as age, income, and spending score. Each cluster represents a segment of customers who behave in similar ways or share similar characteristics. As a marketer, you can use these segments to tailor your campaigns, personalize offers, and allocate your budget more effectively, ensuring your message resonates with the right audience.
1234567# Assign cluster labels to each customer df["Segment"] = kmeans.labels_ # Summarize each segment segment_summary = df.groupby("Segment").mean(numeric_only=True) print("Segment Summary:") print(segment_summary)
1. What is the main goal of clustering in marketing analytics?
2. Which scikit-learn class is used for KMeans clustering?
3. Fill in the blank: Clustering helps marketers find groups of customers with ______ characteristics.
Tak for dine kommentarer!
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Fantastisk!
Completion rate forbedret til 4.76
Customer Segmentation with Clustering
Stryg for at vise menuen
Clustering is a powerful technique in marketing analytics that helps you discover natural groupings within your customer base. Instead of relying on predefined categories, clustering uses data to reveal segments of customers who share similar behaviors or demographic features. This approach is especially valuable when you want to identify distinct customer segments for more personalized marketing strategies.
12345678910111213141516171819202122import pandas as pd from sklearn.cluster import KMeans # Sample customer data with features: Age, Annual Income (k$), Spending Score (1-100) data = { "CustomerID": [1, 2, 3, 4, 5, 6], "Age": [23, 45, 31, 35, 52, 40], "AnnualIncome": [15, 40, 25, 60, 80, 55], "SpendingScore": [39, 81, 6, 77, 40, 76] } df = pd.DataFrame(data) # Select features for clustering X = df[["Age", "AnnualIncome", "SpendingScore"]] # Create and fit KMeans model kmeans = KMeans(n_clusters=2, random_state=42) kmeans.fit(X) # Output cluster centers print("Cluster Centers:") print(kmeans.cluster_centers_)
Clusters are formed when the algorithm groups customers based on the similarity of their features, such as age, income, and spending score. Each cluster represents a segment of customers who behave in similar ways or share similar characteristics. As a marketer, you can use these segments to tailor your campaigns, personalize offers, and allocate your budget more effectively, ensuring your message resonates with the right audience.
1234567# Assign cluster labels to each customer df["Segment"] = kmeans.labels_ # Summarize each segment segment_summary = df.groupby("Segment").mean(numeric_only=True) print("Segment Summary:") print(segment_summary)
1. What is the main goal of clustering in marketing analytics?
2. Which scikit-learn class is used for KMeans clustering?
3. Fill in the blank: Clustering helps marketers find groups of customers with ______ characteristics.
Tak for dine kommentarer!