1
$\begingroup$

I'm trying to cluster a dataset using 4 variables, all of which are categorical variables. I'd also like to include another numerical variable that's actually the number of observations of another column. My data is laid out like below:

ColA, ColB, ColC, ColD, ColE

where ColE would be the frequency of ColD; and all Columns A-D are categorical variable. I don't want to use a supervising learning technique because of various reasons (the top one being I don't know what my result should be; only that I want to have k number of groups that are similar enough). What's the best clustering algorithm to use for this? I've been thinking k-modes but that doesn't solve the problem of ColE being a feature of ColD.

Thanks!

$\endgroup$
  • $\begingroup$ Could you possibly provide an example of your data record. Especially the relationship of D and E seems to be unclear somehow. $\endgroup$ – Karel Macek Jun 12 '17 at 20:38
  • $\begingroup$ Sure, so the dataset looks like this: with Color being ColD and Frequency being ColE: Item | Season | Type | Color| Frequency Clothing| Summer| Suit| Navy| 2 Clothing| Summer| Suit| Black| 3 Clothing| Summer| Suit| Grey | 3 $\endgroup$ – sudhareg Jun 12 '17 at 21:05
  • $\begingroup$ Sorry, the formatting here is confusing me a little bit. But the column E is a frequency column that denotes the number of observation for all the characteristics. I want a clustering of "like" ColA based on the characteristics of columns B, C, D and E but want to use unsupervised learning algorithm. thanks! $\endgroup$ – sudhareg Jun 12 '17 at 21:07
0
$\begingroup$

Have you tried encoding the categorical variables into numeric? http://fastml.com/converting-categorical-data-into-numbers-with-pandas-and-scikit-learn/

I would recommend starting with maybe two variables to apply K-modes and then iterate/increase the number of variables from there, as you analyze the results.

$\endgroup$
  • $\begingroup$ Thanks for the suggestion! Dummy variables doesn't work in my case because you end up vastly increasing the problem size- my categorical values have many values (~1000 in one case) so I'd need to add 999 new columns just to get that one column. The categorical vars part of the problem is solved using k-means/k-prototypes. My main problem is dealing with a dependent numeric variable (frequency count of each observation) - where I want the frequency of the observation to matter as well. $\endgroup$ – sudhareg Jun 13 '17 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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