1
$\begingroup$

I am doing a clustering analysis using K-means and I have around 6 categorical variables that I want to consider in the model. When I transform these variables as dummy variables (binary values 1 - 0) I got around 20 new variables. Since two assumptions of K-means are Symmetric distribution (Skewed) and same variance and mean (scale). Do I need to transform these variables?

$\endgroup$
1
  • $\begingroup$ Welcome to DataScienceSE. As far as I know there's not a lot of transformation you can do if you have binary variables, anyway. Since you have only 6 categorical variables and this leads to only 20 variables, I would start by simply counting the frequency of each combination of values (i.e. how many distinct instances). It's possible that you have a few very frequent cases which represent 99% of the data. $\endgroup$
    – Erwan
    Commented Jun 10, 2021 at 20:23

2 Answers 2

1
$\begingroup$

If you have exclusively binary variable you can use KModes, if you have both real and binary variables I would consider the KPrototypes algorithm. KModes use by default the hamming distance and prototype computation use the mod instead of the mean. KPrototypes mix both KMeans and KModes for each kind of features using euclidean and hamming for distance computation and mean and mod for getting both part of the prototypes.

$\endgroup$
1
$\begingroup$

You may be interested on DenseClus

DenseClus uses the uniform manifold approximation and projection (UMAP) and hierarchical density based clustering (HDBSCAN) algorithms to arrive at a clustering solution for both categorical and numerical data. With DenseClus, you provide a dataframe, and it will then generate homogeneous clusters with no need for extensive preprocessing or worrying about how to treat categorical features. This capability opens a wide range of use cases, from customer segmentation in marketing to mapping cells in biomedicine.

enter image description here

$\endgroup$

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.