This project groups store customers by how recently they bought (Recency), how often (Frequency), and how much they spent (Monetary). The result is four segments ready for tailored promotion strategies.
Business Goal
Group 1,500 customers into valuable segments with K-Means. Application area: Marketing. Project level: beginner.
RapidMiner Tools and Operators
The process is built with these operators:
- Read CSV
- Set Role
- Select Attributes
- Normalize
- K-Means
- Cluster Distance Performance
- Extract Cluster Prototypes
- Performance to Data
- Write CSV
What You Will Learn
- Understand how K-Means works and why data must be normalised
- Turn centroid numbers into segment names that marketing teams can use
- Practise reading cluster quality measures as a basis for choosing the number of segments
Working Steps
- Read the customer data — Use Read CSV to load transaksi_pelanggan.csv (1,500 rows). Make sure the numeric columns are read as numbers.
- Set the identity column — With Set Role, make id_pelanggan the id role so it is not used for clustering but stays in the output.
- Select the RFM attributes — Select Attributes keeps only recency_hari, frekuensi, and monetari_rp. City and age are left out so segments reflect purchasing behaviour only.
- Rescale with Normalize — Choose the Z-transformation method. Without it, the rupiah column (millions) would dominate distances and overpower the other columns.
- Run K-Means — Set k = 4, max runs = 10, and turn on determine good start values. The operator adds a cluster column to every customer.
- Measure cluster quality — Cluster Distance Performance computes the average distance to the centroid and the Davies-Bouldin index. The smaller both are, the tighter and better separated the clusters.
- Extract the centroids — Extract Cluster Prototypes turns the model into a centroid table (standardised R, F, M) used to name the segments.
- — Three Write CSV operators save the segmented customers, centroids, and quality measures to the results folder for use in Excel.



