title: Wrap-around when calculating distance for k-means
body: <p>I'm trying to do a K-means clustering of some dataset using sklearn. The problem is that one of the dimensions is hour-of-day: a number from 0-23 and so the distance algorithm then thinks that 0 is very far from 23, because in absolute terms it is. In reality and for my purposes, hour 0 is very close to hour 23. Is there a way to make the distance algorithm do some form of wrap-around so it computes the more 'real' time difference.
  I'm doing something simple, similar to the following:</p>
  
  <pre><code>from sklearn.cluster import KMeans
  
  clusters = KMeans(n_clusters = 2)
  data = vstack(data)
  fit = clusters.fit(data)
  classes = fit.predict(data)
  </code></pre>
  
  <p><code>data</code> elements looks something like <code>[22, 418, 192]</code> where the first element is the hour.</p>
  
  <p>Any ideas?</p>