title: Use Absolute Pearson Correlation as Distance in K-Means Algorithm (MATLAB)
body: <p>I need to do some clustering using a correlation distance but instead of using the built-in 'distance' 'correlation' which is defined as d=1-r I need the absolute Pearson distance. In my application anti-correlated data should get the same cluster ID. And now when using the kmeans() function I'm getting centroids that are highly anticorrelated which I would like to avoid by combining them. Now, I'm not that fluent in matlab yet and have some problems reading the kmeans function. Would it be possible to edit it for my purpose?</p>
  <p>Example: <img src="https://i.imgur.com/uwLxocw.png" alt="" /></p>
  <p>Row 1 and 2 should get the same cluster ID  when using the correlation distance as metrics.</p>
  <p>I did some attempts to edit the built-in matlab function ( open kmeans- &gt;line 775)
  but what's weird - when I change the distance function I'm getting a valid distance matrix but wrong cluster indexes, can't find the reason for it.
  Would love to get some tips! all best!</p>