Normalize data before measuring the distance
2 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Shashank Prasanna
on 20 Mar 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 Comments
See Also
Categories
Find more on Measurements and Feature Extraction in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!