I have a dataset mixture of categorical and numerical variable, I was wonder what are the best algorithms to cluster customers?

how to find the underlying patterns that segments a customer??


1 Answer 1


It is obvious with the problem statement that you are willing to perform clustering operation on your dataset so most clustering algorithms will be applicable.

If you are looking for some algorithms which can perform clustering, Try looking into the following

K-Means Clustering - One of the most popular one, a centroid based algorithm which clusters the datapoints based on the number of centroids you enter. Assumes all data clusters are spherical which can be good at times.

DBSCAN - Density-Based Spatial Clustering of Applications with Noise aka DBSCAN is good if you don't have a clue on how many segments could have been in the data. This algorithm is really good at catching outliers. Unlike in K Means which assumes all the clusters are spherical, DBSCAN is good with non-spherical distribution.

Hierarchical Clustering - Hierarchical Clustering starts of with one datapoint and creates clusters by merging multiple points but its simple and struggles to handle large dataset sometimes.

Spectral Clustering - Spectral Clustering uses a similarity matrix to find datapoints and group them into appropriate clusters. Never used it myself but works similar to Hierarchical interms of computation.

Gaussian Mixture Model - Assumes data is normally distributed. More of a probability based model and very good at catching outliers and non linear data. If the data is too complex, you may need to add more and more gaussian components(normal distribution is the assumption).

These are some of the algorithms which you use for custom segmentation.

How to find the underlying patterns that segments a customer??

Ultimately, your model is the one which is going to understand the patterns within the dataset and give prediction. We can infer from model metrics on whether the patterns are learnt or not. But if you want to know which features contribute for patterns within custom behavior you can use EDA tools like heatmap or covariance matrix or you can use SHAP (SHapley Additive exPlanations) to see which features contribute to formation of each cluster.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.