Skip to content

Instantly share code, notes, and snippets.

@RyotaBannai
Last active January 3, 2019 20:00
Show Gist options
  • Save RyotaBannai/a069070dfd5be78d6bb4c8248ef71604 to your computer and use it in GitHub Desktop.
Save RyotaBannai/a069070dfd5be78d6bb4c8248ef71604 to your computer and use it in GitHub Desktop.
N=60
mu=0
sd=2
np.random.seed(0)
ran = np.random.normal(size=N)
error1 = sd**2 * ran + mu
error2 = sd*.5 * ran + mu
lin = np.linspace(-15., 15., num=N)
data = lin + error2
data_true = lin
true_func = lambda x, e: .1*x + .1*x**2 + e
x = np.vstack((data, data**2)).T
y_true = np.array([true_func(d, 0) for d in data_true])
y_data = np.array([true_func(d, e) for d,e in zip(data, error1)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment