How is the "correlation distance" obtained after k-means with correlation is applied?

1 view (last 30 days)
Hi,
I have performed k-means calculation to a set of curves. The traditional k-means calculation minimises euclidean distance but matlab makes possible to minimise the "correlation distance".
Once the centroids are obtained the error (distance) between a curve and its centroid, in the case con euclidean distance this error is equal to the root of the sum of squared difference between all the coordinates (values of the curves):
(sum( (xi - ci)^2 ))^0.5; being xi the values of the curve and ci the values of the centroid.
I have done it manually and it matches with the matlab's result, as expected.
Problem. I have tried to obtain the correlation distance between a curve and its correlation centroid (in order to understand the internal process) without success.
vector = [0.183, 0.212, 0.237, 0.266, 0.286, 0.293, 0.296, 0.285, 0.292, 0.285, 0.278, 0.249, 0.225, 0.184, 0.173, 0.153, 0.182, 0.207, 0.237, 0.232, 0.221, 0.203, 0.177, 0.168, 0.16]
centroid = [ -0.21855, -0.12294, -0.00591, 0.096538, 0.188009, 0.229715, 0.254094, 0.22736, 0.204908, 0.175345539, 0.133732, 0.046236, 0.03547, -0.00712, -0.02923, -0.03936, -0.0303, -0.02336, -0.06685, -0.10802, -0.13891, -0.17165, -0.20264, -0.20557, -0.221 ]
The correlation distance is defined as [ 1 - pearson(vector,centroid) ] but, where matlab gives 0.37917 I obtain 0.1437.
What am I doing bad?
Thank you all in advance,
Jaime
  1 Comment
Jaime Almonacid-Caballer
Jaime Almonacid-Caballer on 23 Jun 2021
Edited: Jaime Almonacid-Caballer on 23 Jun 2021
I found it:
The correlation distance is ROOT( 1 - pearson(vector,centroid) )
I leave it here just in case it can be useful for anyone.
My apologies

Sign in to comment.

Answers (0)

Categories

Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!