Calculating weighted Euclidean distance with given weights

19.8k Views Asked by At

This question is regarding the weighted Euclidean distance. I have three features and I am using it as three dimensions. I need to place 2 projects named A and B in this 3 dimensional space and measure the distance among them.

But the case is I need to give them separate weights.

if first feature is given weight 1, second feature should be given weight 2 and third feature must be given weight 3.

If values of project A are (4,3,2) and values of project B are (6,2,7) can I use the weighted values as it is to calculate the distances between 2 projects?

Please someone kindly help me in solving this? If this method is wrong is there any other way that I can use this?

The basic thing what I need is giving them weights "what I need". This is just an example. I would be needed to expand this upto a n dimensional space. It would be able to be achieved using Euclidean distance. But main problem what I am facing is giving them weights what I am looking for.

P.S

enter image description here

1

There are 1 best solutions below

4
On

You can indeed use the weighted Euclidean distance between $A$ and $B$ $$ d(A,B) = \sqrt{\sum_{i} w_{i}(A_{i}-B_{i})^{2}}, $$ where $A_{i}$ is the $i$-th feature for A and $w_{i}$ is the weight you want to give to feature $i$.

If you have many points in your space, one possible way to chose $w_{i}$ is the inverse variance of the feature $i$. It's called the Mahalanobis distance.