Generate a noisy polynomial for a regression problem

    Examples
    --------
    >>> X, y, coefs = make_polynomial(degree=3, n_samples=200, noise=.5,
    ...                               return_coefs=True, random_state=1)

def make_polynomial(degree=3, n_samples=100, bias=0.0, noise=0.0,
                    return_coefs=False, random_state=None):
    """
    Generate a noisy polynomial for a regression problem

    Examples
    --------
    >>> X, y, coefs = make_polynomial(degree=3, n_samples=200, noise=.5,
    ...                               return_coefs=True, random_state=1)
    """
    generator = check_random_state(random_state)

    # TODO: Add arguments to support other priors
    coefs = generator.randn(degree + 1)
    pows = np.arange(degree + 1)
    poly = np.vectorize(lambda x: np.sum(coefs * x ** pows))
    X, y = make_regression(poly, n_samples=n_samples, bias=bias, noise=noise,
                           random_state=random_state)
    if return_coefs:
        return X, y, coefs

    return X, y