# Does any other clustering algorithms take correlation as distance metric (apart from Hierachical)?

I have used correlation metric as distance measure for hierachical clustering and obtained the clusters. I used scikit (python 3.5) for clustering hierachical cluster.

Now, I want to use another clustering algorithm with same dataset.

I am not sure whether any other clustering algorithms will take correlation as distance metric.

I request you to assist with which algorithms are feasible for this ? and How can I use it.

• Almost every algorithm except k-means and GMM. Have a look at ELKI, it includes correlation (maybe even with index for acceleration!) and several clustering algorithms such as DBSCAN, OPTICS, HDBSCAN*, that can be used with correlation distance. – Has QUIT--Anony-Mousse Apr 25 '17 at 19:37
• You are right. Those are implemented in JAVA. Can you assist me with Python implementations – Abhishek Apr 26 '17 at 7:59

• Yes, first you use dist=sklearn.metrics.pairwise.pairwise_distances(data) to calculate the distance matrix from your data, and then you use the resulting dist object as input to the clustering algorithms, remembering to select the option affinity="precomputed for affinity propagation or metric="precomputed" in the case of DBSCAN. BTW for affinity propagation I think you need to transform the distances into similarities. – Leo Martins Apr 25 '17 at 12:00
• Each element of your data set with each other, yes. Suppose your data set are N rows (samples) with M columns (dimensions, features). then sklearn.metrics.pairwise.pairwise_distances(data, metric="correlation") will return a matrix of size NxN with the correlation distances between the elements. (I assumed this is how you obtained the distances inthe first place.) – Leo Martins Apr 26 '17 at 9:32