(X, scale=1., min_divisor=1e-8)
return X
Subtract mean and normalize by vector norm.
Subtract mean and normalize by vector norm.
Subtract mean and normalize by vector norm .
def global_contrast_normalize(X, scale=1., min_divisor=1e-8):
        """
        Subtract mean and normalize by vector norm.
        """

        X = X - X.mean(axis=1)[:, np.newaxis]

        normalizers = np.sqrt((X ** 2).sum(axis=1)) / scale
        normalizers[normalizers < min_divisor] = 1.

        X /= normalizers[:, np.newaxis]

        return X
def global_contrast_normalize ( X , scale = 1. , min_divisor = 1e-8 ) : X = X - X . mean ( axis = 1 ) [ : , np . newaxis ] normalizers = np . sqrt ( ( X ** 2 ) . sum ( axis = 1 ) ) / scale normalizers [ normalizers < min_divisor ] = 1. X /= normalizers [ : , np . newaxis ] return X