The following data, represent 2 given histograms split into 13 bins:
key 0 1-9 10-18 19-27 28-36 37-45 46-54 55-63 64-72 73-81 82-90 91-99 100
A 1.274580708 2.466224824 5.045757621 7.413716262 8.958855646 10.41325305 11.14150951 10.91949012 11.29095648 10.95054297 10.10976255 8.128781795 1.886568472
B 0 1.700493692 4.059243006 5.320899616 6.747120132 7.899067471 9.434997257 11.24520022 12.94569391 12.83598464 12.6165661 10.80636314 4.388370817
I'm trying to follow this article in order to calculate the intersection between those 2 histograms, using this method:
def histogram_intersection(h1, h2, bins):
bins = numpy.diff(bins)
sm = 0
for i in range(len(bins)):
sm += min(bins[i]*h1[i], bins[i]*h2[i])
return sm
Since my data is already calculated as a histogram, I can't use numpy built-in function, so I'm failing to provide the function the necessary data.
How can I process my data to fit the algorithm?
