Skip to content

Instantly share code, notes, and snippets.

@vlavorini
Last active August 11, 2017 17:53
Show Gist options
  • Save vlavorini/f1083e590cd98b0d546eec13f00d5cc5 to your computer and use it in GitHub Desktop.
Save vlavorini/f1083e590cd98b0d546eec13f00d5cc5 to your computer and use it in GitHub Desktop.
def _dist_poinc(a, b):
num=np.dot(a-b, a-b)
den1=1-np.dot(a,a)
den2=1-np.dot(b,b)
return np.arccosh(1+ 2* (num) / (den1*den2))
def dist_poinc(a, A):
res=np.empty(A.shape[0])
for i, el in enumerate(A):
res[i]=_dist_poinc(a, el)
return res
def gaussian(d, bw):
return np.exp(-0.5*(d/bw)**2) / (bw*np.sqrt(2*np.pi))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment