Last active
January 5, 2023 14:16
-
-
Save benoitdescamps/c36319ea11cb9981980abfa16a523d6f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
np.random.seed(1) | |
def f(x): | |
"""The function to predict.""" | |
return x *np.sin(x) | |
#---------------------------------------------------------------------- | |
# First the noiseless case | |
X = np.atleast_2d(np.random.uniform(0, 10.0, size=100)).T | |
X = X.astype(np.float32) | |
# Observations | |
y = f(X).ravel() | |
dy = 1.5 + 1.0 * np.random.random(y.shape) | |
noise = np.random.normal(0, dy) | |
y += noise | |
y = y.astype(np.float32) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment