| 69 | candidate = [v for x, v in candidate.items()] |
| 70 | |
| 71 | def ax_plot(title, ax, train_x, plot_y, test_size, cmap): |
| 72 | ax.plot(train_x[:, 0], train_x[:, 1], "k*") |
| 73 | # Predictive mean as blue line |
| 74 | with warnings.catch_warnings(): |
| 75 | warnings.simplefilter("ignore") |
| 76 | h1 = ax.contourf( |
| 77 | xgrid_0, |
| 78 | xgrid_1, |
| 79 | plot_y, |
| 80 | np.arange(-3, 3.5, 0.5), |
| 81 | cmap=cmap, |
| 82 | ) |
| 83 | c1 = plt.colorbar(h1, ax=ax) |
| 84 | # ax.clabel(C, inline=True) |
| 85 | min_loc_1 = ( |
| 86 | int(np.argmin(plot_y) / test_size), |
| 87 | np.remainder(np.argmin(plot_y), test_size), |
| 88 | ) |
| 89 | ax.plot(xgrid_0[min_loc_1], xgrid_1[min_loc_1], "b*") |
| 90 | |
| 91 | ax.set_xlim([-1, 1]) |
| 92 | ax.set_title(title) |
| 93 | |
| 94 | # PLot true contour in the left plot |
| 95 | ax_plot( |