def isolation_isg(x):
    """
    Isolation index IS

    ...

    Arguments
    ---------
    x       : array
              N x k array containing N rows (one per neighborhood) and k columns
              (one per cultural group)
    Returns
    -------
    a       : array
              Array with ISg indices for the k groups
    """
    ws = x * 1.0 / x.sum(axis=0)
    pgapa = (x.T * 1.0 / x.sum(axis=1)).T
    pgp = x.sum(axis=0) * 1.0 / x.sum()
    return (ws * pgapa / pgp).sum(axis=0)
