def normalize(x):
    """
    Helper function for normalizing the inputs.

    Normalization is an affine transformation such that the minimal element of x maps to 0, and maximal element of x
    maps to 1

    Args:
        x (``np.ndarray``): the array to be normalized

    Returns:
         ``np.ndarray``: a normalized array such that the minimum is 0 and the maximum is 1
    """
    return (x - x.min()) / (x.max() - x.min())