SHARE
TWEET

Untitled

a guest Oct 15th, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import scipy.special
  2.  
  3. def getARI(mat, k, s, total):
  4.    
  5.     t1 = 0
  6.    
  7.     for i in range(k):
  8.         sum_k = 0
  9.         for j in range(s):
  10.             sum_k += mat[i][j]
  11.        
  12.         t1 += scipy.special.binom(sum_k, 2)
  13.        
  14.     t2 = 0
  15.    
  16.     for i in range(s):
  17.         sum_s = 0
  18.         for j in range(k):
  19.             sum_s += mat[j][i]
  20.        
  21.         t2 += scipy.special.binom(sum_s, 2)
  22.        
  23.     t3 = t1*t2/scipy.special.binom(total, 2)
  24.    
  25.     t = 0
  26.    
  27.     for i in range(k):
  28.         for j in range(s):
  29.             t += scipy.special.binom(mat[i][j], 2)
  30.        
  31.     ari = (t-t3)/((t1+t2)/2-t3)*100
  32.    
  33.     return ari
  34.  
  35. prev_ari = getARI(bins_species, 2, 2, total_maxbin_binned)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top