Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Customer Segmentation with Clustering | Advanced Analytics for Marketers
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Python for Marketers

bookCustomer 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.

12345678910111213141516171819202122
import 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_)
copy

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)
copy

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.

question mark

What is the main goal of clustering in marketing analytics?

Select the correct answer

question mark

Which scikit-learn class is used for KMeans clustering?

Select the correct answer

question-icon

Fill in the blank: Clustering helps marketers find groups of customers with ______ characteristics.

characteristics.

Натисніть або перетягніть елементи та заповніть пропуски

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 3. Розділ 4

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

bookCustomer 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.

12345678910111213141516171819202122
import 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_)
copy

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)
copy

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.

question mark

What is the main goal of clustering in marketing analytics?

Select the correct answer

question mark

Which scikit-learn class is used for KMeans clustering?

Select the correct answer

question-icon

Fill in the blank: Clustering helps marketers find groups of customers with ______ characteristics.

characteristics.

Натисніть або перетягніть елементи та заповніть пропуски

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 3. Розділ 4
some-alt