I have a dataset with the following variables (among ohter variables) that represents custome card transactions and I'm trying to cluster the clusters using k-means.
GENDER_M: can be 0, 1 or NA GENDER_F: can be 0, 1 or NA
I'm trying K-means using R packages NbClust and cluster
Now, on this other question I wrote that hot encoding these variables didn't work out very well. I tried:
GENDER_M0: 1 for all the records that contain 0 in column GENDER_M - 0 otherwise GENDER_M1: 1 for all the records that contain 1 in column GENDER_M - 0 otherwise GENDER_MNA: idem GENDER_F0: idem GENDER_F1: idem GENDER_FNA: idem
So, in total, I have 5 possible combinations:
NA/NA 0/0 0/1 1/0 1/1
1 means that there's a presence of the respective gender in the buying patters of the customer. For example, if a customer buys razors repeatedly, he will get a 1 in column GENDER_M.
Can anyone advise on a good method to deal with categorical variables in a clustering problem?