필터 지우기
필터 지우기

Normalize data before measuring the distance

조회 수: 5 (최근 30일)
KnowledgeSeeker
KnowledgeSeeker 2014년 3월 20일
답변: Shashank Prasanna 2014년 3월 20일
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

답변 (1개)

Shashank Prasanna
Shashank Prasanna 2014년 3월 20일
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))

Community Treasure Hunt

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

Start Hunting!

Translated by