LoslegenKostenlos loslegen

Segmenting customers

In this exercise, you'll perform a Customer Segmentation from the Mall Customer Segmentation Dataset using a differentially private clustering model.

In K-means clustering, you can calculate the optimal number of clusters with the elbow method.

Resulting graphic from Elbow method with non-private model
From the resulting graphic, notice that the optimal number of clusters is 5. You'll cluster based on Annual Income and Spending Score, which have been loaded as X, and plot the resulting clusters.

The full dataset has been loaded as mall_df. For convenience, a custom function show_clusters() to plot the clusters is provided to you. Use ?show_clusters to learn more about it.

Diese Übung ist Teil des Kurses

Data Privacy and Anonymization in Python

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Build the differentially private K-means model
model = ____
Code bearbeiten und ausführen