Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p(XY) = 0.5 * P(X = Y) + 1 * P(X > Y)
- import numpy as np
- x = [-0.01, -0.05, -0.13, -0.02, -0.17, -0.09, 0.0, -0.04, -0.03, 0.06, -1.37, -0.03, 0.01, -0.57, 0.04, -0.09, -0.04, -5.56, -0.02, 0.0, 0.0, 0.0, 0.0, -0.03, -0.55, -2.6, -0.42, -1.35, 0.0, 0.43, -0.74, -0.47, 0.0, -20.25, -11.18, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
- y = [0.0, -0.16, -0.11, -0.04, -0.1, 0.02, -0.04, -0.13, -0.03, -0.04, 0.0, -0.01, 0.01, -0.38, 0.13, -0.26, -0.11, -0.09, 0.0, 0.0, 0.18, 0.0, -0.02, 0.03, -0.17, 0.21, 0.17, -0.42, 0.0, 0.87, 0.15, 0.0, 0.47, 3.73, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
- bins = np.arange(min(x + y), max(x + y), 0.01)
- # x histogram (normalized to sum 1.0)
- hx, dx = np.histogram(x, bins)
- hx = 1.0*hx/np.sum(hx) # max(hx) = 0.3170731707317073
- # y histogram (normalized to sum 1.0)
- hy, dy = np.histogram(y, bins)
- hy = 1.0*hy/np.sum(hy) # max(hy) = 0.34999999999999998
- # Now comes the hard part, the result doesn't match with the paper (0.345)
- # this gives 1.03597561
- np.correlate(hx, hy)*0.5 + sum(np.correlate(hx, hy, 'same'))
- # this gives 1.06097561
- np.correlate(hx, hy)*0.5 + sum(np.correlate(hx, hy, 'full'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement