Normalize data before measuring the distance
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Shashank Prasanna
el 20 de Mzo. de 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 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!