Covariate shift in k-means clustering I'm trying to build a customer segmentation framework on e-commerce data. To do this, I'm using k-means clustering on variables which quantify the purchase Recency, purchase Frequency, Monetary value of the purchase (RFM segmentation) + additionally I have also used the Age of the customer (not biological but age on the website). I have derived 5 clusters out of this data using elbow method & applying some business sense. The clusters have been able to segregate buyers as

*

*Best Customers (Almost Recent, Most Frequent, High Revenue, High Tenured)

*Reliable Customers (safe for business) (Almost Recent, Frequent, Decent Revenue, Mid Tenure)

*Dormant Customers

*Single Purchasers tending to become dormant

*New Customers

Now I would like to deploy this framework and use these insights in the marketing activities. I'm planning to schedule this as a weekly run. However, every week, there would be change in the data as the number of customers grow, number of purchases increase. Due to this the segments are bound to change (due to covariate shift). Previously cluster 5 were New Customers, now cluster 1 could be New customers etc. This can be inferred only by looking at the cluster level data. I'm wondering if there is a way to automate this.

You can use online algorithm for $k$-means, so as your data grows and changes, you incrementally adapt. I didn't use it yet, but you may try the river package for Python that implements online machine learning algorithms, including $k$-means.
