# generate raw data
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
def f_fun(x):
return 10 * np.sin(2 * np.pi * x)
num_samples = 32
X = np.linspace(-0.5, 0.5, num_samples).reshape(-1, 1)
y_true = f_fun(X)
y = y_true + np.random.randn(num_samples, 1)
plt.scatter(X, y, marker='+', color='y', label='Training data')
plt.plot(X, y_true, label='Truth')
plt.grid()
plt.legend()