'Subtract mean and normalize by vector norm.'

@staticmethod
def global_contrast_normalize(X, scale=1.0, min_divisor=1e-08):

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