In my application I have to calculate the distance between two vectors, each of which is contained of points ranging from -1 to 1. For example, the distance between these two vectors:
.75 .06
.20 -.44
-.95 .17
-.32 .85
.04 -.12
is calculated by taking the absolute value of the difference between each pairing, like so:
abs(.75 - .06) = 0.69
abs(.20 - -.44) = 0.64
abs(-.95 - .17) = 1.12
abs(-.32 - .85) = 1.17
abs(.04 - -.12) = 0.16
They are then summed and divided by the count:
(.69 + 0.64 + 1.12 + 1.17 + 0.16) / 5 = 0.756
The distance ranges from -1 to 1, which is a property I need to maintain.
This all works well and good, but I'd like to impose an additional constraint of weighting. For example, I'd like the third pairing (-0.95, .17) to be worth, say, 3x as much as the others. I'm not sure how to change the algorithm to account for this.
I can't just multiply it by 3, because then the result is no longer in the range [-1, 1], and this must be up-held. Apologies if this has a trivial answer, I'm really bad at math.
Also, just to clarify, I'll need to weight multiple pairings, each with arbitrary amounts (for example: the first pairing weighted 2x, the third pairing weighted 0.5x, the fouth pairing weighted 4x, etc.).
Assuming all your $\Delta$'s are in $[0,2]$, in order to get a weighted distance in $[0,2]$, you should divide by the sum of the contribitions of all the factors, so $$ d = 1/(w_x + w_y + ...) (w_x \Delta x + w_y \Delta y + ...) $$
Further, why are negative distances allowed? A negative distance cannot be obtained with a valid metric.