Skip to content
Snippets Groups Projects
Commit a1e55156 authored by rink's avatar rink
Browse files

add option to pass in absolute tolerance

parent bba60dd4
Branches
No related tags found
No related merge requests found
...@@ -22,7 +22,7 @@ def true_func(x): ...@@ -22,7 +22,7 @@ def true_func(x):
# Y = 2 + 1.5 * X + epsilon # Linear relationship with variance increasing # Y = 2 + 1.5 * X + epsilon # Linear relationship with variance increasing
# Y = 1 + np.exp(X / 4) + epsilon # Y = 1 + np.exp(X / 4) + epsilon
# Y = 1 + np.exp(X / 4) + np.sin((2*np.pi/5)*X) # Y = 1 + np.exp(X / 4) + np.sin((2*np.pi/5)*X)
return 1 + np.exp(x / 4) + 3*np.sin((2*np.pi/5)*x) return 1 + np.exp(x / 3) + 4*np.sin((2*np.pi/5)*x) + (0.5 + x/5)*np.cos((2*np.pi/2)*x)
# Generate synthetic dataset # Generate synthetic dataset
def make_data(num_points=1000): def make_data(num_points=1000):
...@@ -85,7 +85,7 @@ def run(num_points=1000, num_plot_pts=200): ...@@ -85,7 +85,7 @@ def run(num_points=1000, num_plot_pts=200):
# Plot the results # Plot the results
plt.figure(figsize=(8, 6)) plt.figure(figsize=(8, 6))
plt.scatter(X_test[::4, 0], Y_test[::4, 0], alpha=0.3, label="Test Data") # plt.scatter(X_test[::4, 0], Y_test[::4, 0], alpha=0.3, label="Test Data")
plt.plot(X_range, predictions[0.05], label="Quantile 0.05", color='red') plt.plot(X_range, predictions[0.05], label="Quantile 0.05", color='red')
plt.plot(X_range, predictions[0.5], label="Quantile 0.5 (Median)", color='green') plt.plot(X_range, predictions[0.5], label="Quantile 0.5 (Median)", color='green')
plt.plot(X_range, predictions[0.95], label="Quantile 0.95", color='blue') plt.plot(X_range, predictions[0.95], label="Quantile 0.95", color='blue')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment