m = lambda x: model.predict(x) sd2 = lambda x: model.predict(x, eval_MSE=True)[1] m_dx = lambda x: model.gradient(x)[0] sd2_dx = lambda x: model.gradient(x)[1] if 1 < 2: fig0, (ax0, ax1, ax2) = plt.subplots(1, 3, sharey=False, sharex=False, figsize=(fig_width, fig_height), subplot_kw={'aspect': 'equal'}, dpi=100) gs1 = gridspec.GridSpec(1, 3) gs1.update(wspace=0.025, hspace=0.05) # set the spacing between axes. plot_contour_gradient(ax0, fitness, None, x_lb, x_ub, title='Noisy function', n_level=20, n_per_axis=200) plot_contour_gradient(ax1, m, m_dx, x_lb, x_ub, title='GPR estimation', n_level=20, n_per_axis=200) plot_contour_gradient(ax2, sd2, sd2_dx, x_lb, x_ub, title='GPR variance', n_level=20, n_per_axis=200) plt.tight_layout() fig1, ax3 = plt.subplots(1, 1, figsize=(fig_width, fig_height), subplot_kw={'aspect': 'equal'}, dpi=100) plot_contour_gradient(ax3, infill, infill_dx, x_lb, x_ub, title='Infill-Criterion', is_log=True, n_level=50, n_per_axis=250) plt.tight_layout()
f = EI(model) def __(x): _, dx = f(x, dx=True) return dx return __ f = EI(model) dx = grad(model) fig0, ax0 = plt.subplots(1, 1, sharey=True, sharex=False, figsize=(fig_width, fig_height), subplot_kw={'aspect': 'auto'}, dpi=100) plot_contour_gradient(ax0, f, dx, x_lb, x_ub, title='Function', n_level=15, n_per_axis=120) plt.tight_layout() plt.show()