I want to do soft-binning for a distance-based histogram. For example a point X lies somewhere between the center points of 4 bins, A,B,C,D. These four points A,B,C,D can be treated as the vertices of a square.

I would like to assign each of these vertex points a certain weightage (between 0-1) based how much the point X is closer to that vertex with two conditions:

* Sum of vertex weights should be 1.

* If X lies on the line between two vertices, only those two vertices should get the share in weightage.

Currently I calculate the weightage as:

WA =(1 - distance of A from X/sum of distances of all vertices from X )/3

Similar questions and discussions