Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

Just wondering if anyone is familiar with clustering nominal inputs. I've been looking at SOM as a solution but apparently it only works with numerical features. Are there any extensions for categorical features? Specifically I was wondering about 'Days of the Week' as a possible features. Of course it is possible to convert it into a numerical feature (i.e. Mon - Sun corresponding to nos 1-7) however then the Euclidean distance between Sun and Mon (1&7) would not be the same as the distance from Mon to Tues (1&2). Any suggestions or ideas would be much appreciated.

share|improve this question
(+1) a very interesting question – steffen Jul 19 '11 at 9:22
1  
Cyclic variables are best thought of as elements of the unit circle in the Complex plane. Thus, it would be natural to map the days of the week to (say) the points $\exp(2 j \pi i / 7)$, $j=0, \ldots, 6$; i.e., $(\cos(0), \sin(0))$, $(\cos(2 \pi/7), \sin(2\pi/7))$, ... $(\cos(12\pi/7),\sin(12\pi/7))$. – whuber Jul 19 '11 at 14:02
1  
would i have to code up my own distance matrix then specific to cyclic variables? just wondering if there were already existing algorithms for this type of clustering. thx – Michael Jul 20 '11 at 3:48
@Michael: I believe you will want to specify your own distance metric that is appropriate for your application, and that is defined over all the dimensions in your data, not just the DOW. Formally, letting x, y denote points in your data space, you need to define a metric function d(x,y) with the usual properties: d(x,x)=0, d(x,y)=d(y,x), and d(x,z) <= d(x,y)+d(y,z). Once you've done that, creating the SOM is mechanical. The creative challenge is to define d() in a way that captures the notion of "similarity" appropriate to your application. – Arthur Small Dec 14 '12 at 14:48

1 Answer

Commonly nominal variables are dummy coded when used in SOM (e.g., one variable for with a 1 for Monday 0 for not Monday, another for Tuesday, etc.).

You can incorporate additional information by creating combined categories of adjacent days. For example: Monday&Tuesday, Tuesday&Wednesday, etc. However, if your data relates to human behaviour it is often more useful to use Weekday and Weekend as categories.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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