def make_barrapunto_figures(output_path_prefix, method_name_list,
                            barrapunto_mse, barrapunto_jaccard,
                            barrapunto_k_list):
    sns.set_style("darkgrid")
    sns.set_context("paper")

    translator = get_method_name_to_legend_name_dict()

    barrapunto_k_list = list(barrapunto_k_list)

    fig, axes = plt.subplots(1, 2, sharex=True)

    axes[0].set_title("BarraPunto Comments")
    axes[1].set_title("BarraPunto Users")

    plt.locator_params(nbins=8)

    # Comments
    for m, method in enumerate(method_name_list):
        axes[0].set_ylabel("MSE")
        axes[0].set_xlabel("Lifetime (sec)")
        axes[0].plot(barrapunto_k_list[1:],
                     handle_nan(
                         barrapunto_mse[method]["comments"].mean(axis=1))[1:],
                     label=translator[method])

    # Users
    for m, method in enumerate(method_name_list):
        # axes[1].set_ylabel("MSE")
        axes[1].set_xlabel("Lifetime (sec)")
        axes[1].plot(barrapunto_k_list[1:],
                     handle_nan(
                         barrapunto_mse[method]["users"].mean(axis=1))[1:],
                     label=translator[method])

    axes[1].legend(loc="upper right")

    # plt.show()
    plt.savefig(output_path_prefix + "_mse_barrapunto_SNOW" + ".png",
                format="png")
    plt.savefig(output_path_prefix + "_mse_barrapunto_SNOW" + ".eps",
                format="eps")
def make_barrapunto_figures(output_path_prefix, method_name_list, barrapunto_mse, barrapunto_jaccard, barrapunto_k_list):
    sns.set_style("darkgrid")
    sns.set_context("paper")

    translator = get_method_name_to_legend_name_dict()

    barrapunto_k_list = list(barrapunto_k_list)

    fig, axes = plt.subplots(1, 2, sharex=True)

    axes[0].set_title("BarraPunto Comments")
    axes[1].set_title("BarraPunto Users")

    plt.locator_params(nbins=8)

    # Comments
    for m, method in enumerate(method_name_list):
        axes[0].set_ylabel("MSE")
        axes[0].set_xlabel("Lifetime (sec)")
        axes[0].plot(barrapunto_k_list[1:],
                        handle_nan(barrapunto_mse[method]["comments"].mean(axis=1))[1:],
                        label=translator[method])

    # Users
    for m, method in enumerate(method_name_list):
        # axes[1].set_ylabel("MSE")
        axes[1].set_xlabel("Lifetime (sec)")
        axes[1].plot(barrapunto_k_list[1:],
                        handle_nan(barrapunto_mse[method]["users"].mean(axis=1))[1:],
                        label=translator[method])


    axes[1].legend(loc="upper right")

    # plt.show()
    plt.savefig(output_path_prefix + "_mse_barrapunto_SNOW" + ".png", format="png")
    plt.savefig(output_path_prefix + "_mse_barrapunto_SNOW" + ".eps", format="eps")
def make_reddit_figures(output_path_prefix, method_name_list, reddit_mse, reddit_jaccard, reddit_k_list):
    sns.set_style("darkgrid")
    sns.set_context("paper")

    translator = get_method_name_to_legend_name_dict()

    reddit_k_list = list(reddit_k_list)

    fig, axes = plt.subplots(1, 2, sharex=True)

    axes[0].set_title("RedditNews Comments")
    axes[1].set_title("RedditNews Users")

    plt.locator_params(nbins=8)

    # Comments
    for m, method in enumerate(method_name_list):
        axes[0].set_ylabel("MSE")
        axes[0].set_xlabel("Lifetime (sec)")
        axes[0].plot(reddit_k_list[1:],
                            handle_nan(reddit_mse[method]["comments"].mean(axis=1))[1:],
                            label=translator[method])

    # Users
    for m, method in enumerate(method_name_list):
        # axes[1].set_ylabel("MSE")
        axes[1].set_xlabel("Lifetime (sec)")
        axes[1].plot(reddit_k_list[1:],
                            handle_nan(reddit_mse[method]["users"].mean(axis=1))[1:],
                            label=translator[method])

    axes[1].legend(loc="lower left")

    # plt.show()
    plt.savefig(output_path_prefix + "_mse_com_use_SNOW" + ".png", format="png")
    plt.savefig(output_path_prefix + "_mse_com_use_SNOW" + ".eps", format="eps")

    ####################################################################################################################

    fig, axes = plt.subplots(1, 2, sharex=True)

    axes[0].set_title("RedditNews Score")
    axes[1].set_title("RedditNews Controversiality")

    plt.locator_params(nbins=8)

    # Score-Wilson
    for m, method in enumerate(method_name_list):
        axes[0].set_ylabel("MSE")
        axes[0].set_xlabel("Lifetime (sec)")
        axes[0].plot(reddit_k_list[1:],
                            handle_nan(reddit_mse[method]["score_wilson"].mean(axis=1))[1:],
                            label=translator[method])

    # Controversiality - Wilson
    for m, method in enumerate(method_name_list):
        # axes[1].set_ylabel("MSE")
        axes[1].set_xlabel("Lifetime (sec)")
        axes[1].plot(reddit_k_list[1:],
                            handle_nan(reddit_mse[method]["controversiality_wilson"].mean(axis=1))[1:],
                            label=translator[method])

    axes[1].legend(loc="lower left")

    # plt.show()
    plt.savefig(output_path_prefix + "_mse_sco_ctr_SNOW" + ".png", format="png")
    plt.savefig(output_path_prefix + "_mse_sco_ctr_SNOW" + ".eps", format="eps")

    ####################################################################################################################

    # Controversiality - Wilson
    for m, method in enumerate(method_name_list):
        print(method, "Top-100 Jaccard index")
        print(reddit_jaccard[method]["controversiality_wilson"].mean(axis=1))