Plot a histogram from a numpy array of probabilities

    Args:
        Y_p: An [n] or [n, 1] np.ndarray of probabilities (floats in [0,1])

def plot_probabilities_histogram(Y_p, title=None):
    """Plot a histogram from a numpy array of probabilities

    Args:
        Y_p: An [n] or [n, 1] np.ndarray of probabilities (floats in [0,1])
    """
    if Y_p.ndim > 1:
        msg = (
            f"Arg Y_p should be a 1-dimensional np.ndarray, not of shape "
            f"{Y_p.shape}."
        )
        raise ValueError(msg)
    plt.hist(Y_p, bins=20)
    plt.xlim((0, 1.025))
    plt.xlabel("Probability")
    plt.ylabel("# Predictions")
    if isinstance(title, str):
        plt.title(title)
    plt.show()