示例#1
0
color_norm_ratio = visual_util.make_color_norm(post_uncn_dict["noise"] /
                                               post_uncn_dict["overall"],
                                               method="percentile")
color_norm_pred = visual_util.make_color_norm(
    list(post_mean_dict.values())[:2],  # exclude "resid" vales from pal
    method="percentile")
""" 3.1. posterior predictive uncertainty """
for unc_name, unc_value in post_uncn_dict.items():
    save_name = os.path.join(
        _SAVE_ADDR_PREFIX,
        '{}/ensemble_posterior_uncn_{}.png'.format(family_name, unc_name))

    color_norm = visual_util.posterior_heatmap_2d(unc_value,
                                                  X=X_valid,
                                                  X_monitor=X_train,
                                                  cmap='inferno_r',
                                                  norm=color_norm_unc,
                                                  norm_method="percentile",
                                                  save_addr=save_name)
""" 3.2. posterior predictive mean """
for mean_name, mean_value in post_mean_dict.items():
    save_name = os.path.join(
        _SAVE_ADDR_PREFIX,
        '{}/ensemble_posterior_mean_{}.png'.format(family_name, mean_name))
    color_norm = visual_util.posterior_heatmap_2d(mean_value,
                                                  X=X_valid,
                                                  X_monitor=X_train,
                                                  cmap='RdYlGn_r',
                                                  norm=color_norm_pred,
                                                  norm_method="percentile",
                                                  save_addr=save_name)
示例#2
0
for i, model in enumerate(_MODEL_DICTIONARY['root']):
  weights_dict[model] = weights[:, i]

# prepare color norms for plt.scatter
color_norm_weights = visual_util.make_color_norm(
    list(weights_dict.values())[:1],  
    method="percentile")

for model_name, model_weight in weights_dict.items():
    save_name = os.path.join(_SAVE_ADDR_PREFIX,
                             '{}/ensemble_weights_val_{}.png'.format(
                                 family_name, model_name))

    color_norm = visual_util.posterior_heatmap_2d(model_weight,
                                                  X=X_valid, X_monitor=X_train,
                                                  cmap='viridis',
                                                  norm=color_norm_weights,
                                                  norm_method="percentile",
                                                  save_addr=save_name)

# prepare color norms for plt.scatter
# color_norm_unc = visual_util.make_color_norm(
#     list(post_uncn_dict.values())[:1],  # use "overall" and "mean" for pal
#     method="percentile")
# color_norm_ratio = visual_util.make_color_norm(
#     post_uncn_dict["noise"] / post_uncn_dict["overall"],
#     method="percentile")
# color_norm_pred = visual_util.make_color_norm(
#     list(post_mean_dict.values())[:2],  # exclude "resid" vales from pal
#     method="percentile")

""" 3.1. posterior predictive uncertainty """