def imRcompute(y):

    m,n        = y.shape
    presents   = [0 for i in xrange(n)]
    
    pxys = dict()
    ij  = y.nonzero()
    for k in xrange(len(ij[0])):
        i = ij[0][k]
        j = ij[1][k]
        presents[j] += 1


    imR = 0
    num = n * 1.0
    for j in xrange(n):
        if 0 == presents[j]:
            num -= 1
        else:
            imR += (n-presents[j]) / presents[j]
  

    return imR/num
dataset/ETHPy150Open algorithmdog/Representation-based-Multilabel-Learning/tool/imR_calculater.py/imRcompute/original