From 722e2e814e5ba57f9c12e09f61bcddf6b82a01ab Mon Sep 17 00:00:00 2001 From: jeandut Date: Tue, 20 Aug 2024 17:17:44 +0200 Subject: [PATCH] fixing SMD plot (#54) --- experiments/smd/plot_smd.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/experiments/smd/plot_smd.py b/experiments/smd/plot_smd.py index 0b12effa..252fb57f 100644 --- a/experiments/smd/plot_smd.py +++ b/experiments/smd/plot_smd.py @@ -26,7 +26,7 @@ fname = ( - "/home/owkin/project/results_experiments/smd_cov_shift/results_smd_cov_shift.pkl" + "/home/owkin/fedeca/results_experiments/smd_cov_shift/results_smd_cov_shift.pkl" ) df_res = load_dataframe_from_pickles(fname) @@ -36,6 +36,7 @@ # Preprocess results df = df_res.filter(regex=r"cov_shift|method|rep_id|smd_\w+_X_") + df = ( pd.wide_to_long( df.reset_index(drop=True).reset_index(), @@ -61,15 +62,9 @@ .drop(columns="index") ) -df = df.loc[np.logical_or(df['method'] == "FederatedIPTW", df['weighted'] == "weighted")] +df = df.loc[np.logical_or(df['method'] == "FedECA", df['weighted'] == "weighted")] df.loc[df['weighted'] == "raw", 'method'] = "Unweighted" df['smd'] = np.abs(df['smd']) -method_recoding = { - "FederatedIPTW": "FedECA", - "MAIC": "MAIC", - "Unweighted": "Unweighted", -} -df["method"] = df["method"].replace(method_recoding) # Plot @@ -97,10 +92,10 @@ g.set_ylabels("Covariate") g.set_titles(row_template="{row_name}", col_template="Covariate shift = {col_name}") for ax in g.axes.flat: - ax.axvline(0.1, color="black", linestyle="--", alpha=0.2) + ax.axvline(10, color="black", linestyle="--", alpha=0.2) # g.add_legend(title="Method") -g.savefig("smd_cov_shift.png", bbox_inches="tight") +g.savefig("smd_cov_shift.pdf", bbox_inches="tight")