Exemplo n.º 1
0
    fig_size = (12, 10)

    # Plot
    if args.mode == '1D':
        fig = plt.figure(figsize=fig_size, constrained_layout=True)
        widths = [1, 1]  # columnwise
        heights = [1]*(dim_cand//2)  # rowwise
        spec = fig.add_gridspec(nrows=dim_cand//2, ncols=2, width_ratios=widths, height_ratios=heights)

        for idx_r, row in enumerate(range(dim_cand//2)):
            for idx_c, col in enumerate(range(2)):  # 1st col means, 2nd col stds
                ax = fig.add_subplot(spec[row, col])
                render_singletask_gp(
                    ax, cands, cands_values, min_gp_obsnoise=1e-5,
                    idcs_sel=[idx_r*2 + idx_c], x_label='$\phi_{' + f'{idx_r*2 + idx_c}' + '}$',
                    y_label=r'$\hat{J}^{\textrm{real}}$', curve_label='mean', num_stds=2,
                    show_legend_posterior=False, show_legend_std=True, show_legend_data=args.verbose
                )

    elif args.mode == '2D':
        fig_mean = plt.figure(figsize=fig_size, constrained_layout=True)
        spec = fig_mean.add_gridspec(nrows=1, ncols=2, width_ratios=[12, 1], height_ratios=[1])
        ax_hm_mean = fig_mean.add_subplot(spec[0, 0])
        ax_cb_mean = fig_mean.add_subplot(spec[0, 1])

        fig_std = plt.figure(figsize=fig_size, constrained_layout=True)
        spec = fig_std.add_gridspec(nrows=1, ncols=2, width_ratios=[12, 1], height_ratios=[1])
        ax_hm_std = fig_std.add_subplot(spec[0, 0])
        ax_cb_std = fig_std.add_subplot(spec[0, 1])

        render_singletask_gp(
Exemplo n.º 2
0
    hm_cmap = ListedColormap(sns.color_palette("YlGnBu", n_colors=100)[::-1])
    scat_cmap = LinearSegmentedColormap.from_list("light_to_dark_gray", [(0.95, 0.95, 0.95), (0.05, 0.05, 0.05)], N=256)

    if len(args.idcs) == 1:
        ax.axvline(gt_val_x, c="firebrick", ls="--", lw=1.5, label="gt")

    render_singletask_gp(
        ax,
        cands,
        cands_values,
        min_gp_obsnoise=1e-5,
        data_x_min=ddp_space.bound_lo[args.idcs],
        data_x_max=ddp_space.bound_up[args.idcs],
        idcs_sel=args.idcs,
        x_label=x_label,
        y_label=y_label,
        z_label=r"r$\hat{J}^{\textrm{real}}$",
        heatmap_cmap=hm_cmap,
        num_std=2,
        resolution=201,
        legend_data_cmap=scat_cmap,
        show_legend_data=args.verbose,
        show_legend_posterior=True,
        show_legend_std=True,
        render3D=args.render3D,
    )

    if len(args.idcs) == 2 and not args.render3D:
        # Plot the ground truth domain parameter configuration
        ax_hm_mean.scatter(gt_val_x, gt_val_y, c="firebrick", marker="*", s=60)  # forestgreen
        ax_hm_std.scatter(gt_val_x, gt_val_y, c="firebrick", marker="*", s=60)  # forestgreen
Exemplo n.º 3
0
    # hm_cmap = ListedColormap(sns.color_palette("OrRd", n_colors=100)[::-1])
    # scat_cmap = LinearSegmentedColormap.from_list('white_to_gray', [(1., 1., 1.), (.4, .4, .4)], N=256)
    scat_cmap = LinearSegmentedColormap.from_list('light_to_dark_gray',
                                                  [(.8, .8, .8), (.2, .2, .2)],
                                                  N=256)

    render_singletask_gp(
        [ax_hm_mean, ax_cb_mean, ax_hm_std, ax_cb_std],
        cands,
        cands_values,
        min_gp_obsnoise=1e-5,
        # data_x_min=bounds[0, args.idcs], data_x_max=bounds[1, args.idcs],
        idcs_sel=args.idcs,
        x_label=f'$m_p$',
        y_label=f'$m_r$',
        heatmap_cmap=hm_cmap,
        z_label=r'$\hat{J}^{\textrm{real}}$',
        num_stds=2,
        resolution=151,
        legend_data_cmap=scat_cmap,
        show_legend_posterior=True,
        show_legend_std=True,
        show_legend_data=args.verbose,
        render_3D=False,
    )

    # Plot the ground truth domain parameter configuration
    ax_hm_mean.scatter(0.026, 0.097, c='firebrick', marker='o',
                       s=60)  # forestgreen
    ax_hm_std.scatter(0.026, 0.097, c='firebrick', marker='o',
                      s=60)  # forestgreen
Exemplo n.º 4
0
    if args.mode == "1D":
        fig = plt.figure(figsize=fig_size, constrained_layout=True)
        widths = [1, 1]  # columnwise
        heights = [1] * (dim_cand // 2)  # rowwise
        spec = fig.add_gridspec(nrows=dim_cand // 2, ncols=2, width_ratios=widths, height_ratios=heights)

        for idx_r, row in enumerate(range(dim_cand // 2)):
            for idx_c, col in enumerate(range(2)):  # 1st col means, 2nd col stds
                ax = fig.add_subplot(spec[row, col])
                render_singletask_gp(
                    ax,
                    cands,
                    cands_values,
                    min_gp_obsnoise=1e-5,
                    idcs_sel=[idx_r * 2 + idx_c],
                    x_label="$\phi_{" + f"{idx_r*2 + idx_c}" + "}$",
                    y_label=r"$\hat{J}^{\textrm{real}}$",
                    curve_label="mean",
                    num_std=2,
                    show_legend_posterior=False,
                    show_legend_std=True,
                    show_legend_data=args.verbose,
                )

    elif args.mode == "2D":
        fig_mean = plt.figure(figsize=fig_size, constrained_layout=True)
        spec = fig_mean.add_gridspec(nrows=1, ncols=2, width_ratios=[12, 1], height_ratios=[1])
        ax_hm_mean = fig_mean.add_subplot(spec[0, 0])
        ax_cb_mean = fig_mean.add_subplot(spec[0, 1])

        fig_std = plt.figure(figsize=fig_size, constrained_layout=True)
        spec = fig_std.add_gridspec(nrows=1, ncols=2, width_ratios=[12, 1], height_ratios=[1])