def _normalize(arr):
    """
    Normalize a numpy array into zero-mean and unit-variance.
    """
    avg = arr.mean(axis=0)
    std = arr.std(axis=0)
    arr = arr - avg
    arr[:, std != 0] /= std[std != 0]
    return arr