Normalize data before measuring the distance
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to measure the correlation between data (a row vector). I use euclidean distance to measure how correlated each feature to one another. I want to measure the distance of the first feature against the rest of the features. First I normalize my data:
normalizedData = x/sum(X)
second I use Euclidean distance to measure the distance of one feature to the rest of the features
mydata = {}
for Idx = 1:numel(normalizedData)
euclidean_distance = normalizedData(1) - normailizedData(Idx)
mydata{1,1} = euclidean_distance;
end
I am wondering if the above way is correct or incorrect? can someone suggest me or give me an opinion.
Thank you
0 Kommentare
Antworten (1)
Shashank Prasanna
am 20 Mär. 2014
You can use pdist2 to compute pairwise distances:
If you want to standardize the data before hand, you can use zscore:
But if you want to find correlation between to features you use corr
corr(X(:,1),X(:,2))
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!