def plot_gaussian_process_prediction(figure_handle, mu, test_data, mean_est, mu_test_fct, title): ax = Axes3D(figure_handle) # Make the panes transparent ax.xaxis.set_pane_color((1.0, 1.0, 1.0, 0.0)) ax.yaxis.set_pane_color((1.0, 1.0, 1.0, 0.0)) ax.zaxis.set_pane_color((1.0, 1.0, 1.0, 0.0)) # Make the grid lines transparent ax.xaxis._axinfo["grid"]['color'] = (1, 1, 1, 0) ax.yaxis._axinfo["grid"]['color'] = (1, 1, 1, 0) ax.zaxis._axinfo["grid"]['color'] = (1, 1, 1, 0) # Remove axis ax._axis3don = False # Initial view # ax.view_init(elev=10, azim=-20.) # (default: elev=30, azim=-60) ax.view_init(elev=10, azim=30.) # (default: elev=30, azim=-60) # Plot sphere plot_sphere(ax, alpha=0.4) # Plot training data on the manifold plt_scale_fact = test_function(mu_test_fct, mu_test_fct)[0, 0] nb_data_test = test_data.shape[0] for n in range(nb_data_test): ax.scatter(test_data[n, 0], test_data[n, 1], test_data[n, 2], c=[pl.cm.inferno(mean_est[n] / plt_scale_fact)]) # Plot mean of Gaussian test function ax.scatter(mu[0], mu[1], mu[2], c='g', marker='D') plt.title(title, size=25)
ax.zaxis.set_pane_color((1.0, 1.0, 1.0, 0.0)) # Make the grid lines transparent ax.xaxis._axinfo["grid"]['color'] = (1, 1, 1, 0) ax.yaxis._axinfo["grid"]['color'] = (1, 1, 1, 0) ax.zaxis._axinfo["grid"]['color'] = (1, 1, 1, 0) # Remove axis ax._axis3don = False # Initial view # ax.view_init(elev=10, azim=-20.) # (default: elev=30, azim=-60) ax.view_init(elev=10, azim=30.) # (default: elev=30, azim=-60) # Plot sphere plot_sphere(ax, alpha=0.4) # Plot evaluated points if max_colors is None: max_colors = np.max(y_eval - true_opt_val[0]) for n in range(x_eval.shape[0]): ax.scatter(x_eval[n, 0], x_eval[n, 1], x_eval[n, 2], c=pl.cm.inferno(1. - (y_eval[n] - true_opt_val[0]) / max_colors)) # Plot true minimum ax.scatter(true_min[0, 0], true_min[0, 1], true_min[0, 2],