<jupyter_start><jupyter_text>AutoML performance<jupyter_code>best_model = pd.read_csv("./data/AutoML_models.csv")["BestModel"]
list(best_model.unique())
df = pd.read_csv("./data/AutoML_wo_aod.csv")
df = df.rename(columns={"SpatialScale":"Region"})
#ax = sns.barplot(x="SpatialScale",y="R2",hue="Gas",data=df)
df['type'] = df.apply(lambda x: get_code(x['Gas'], x['AOD']), axis=1)


hatch_dict = {
    "xgboost":"//",
    "lgbm":"\\\\",
    "extra_tree":"||",
    "catboost":"--"
}
hatch_ls = [hatch_dict[k] for k in best_model]
h_idx = 0

for y in ["R2"]:
    g = sns.catplot(x="Region",y=y,
                    hue="type", order=["E","S","W","N","C","A"],
                    col="TimeScale",
                    data=df,kind="bar")
    g.fig.set_size_inches(15,3.6)
    axes = g.axes.flatten()
    for i in range(3):
        axes[i].set_title("")
        axes[i].set_ylim(0,1)
        for _,thisbar in enumerate(axes[i].patches):
            # Set a different hatch for each bar
            thisbar.set_hatch(hatch_ls[h_idx])
            h_idx+=1
    axes[0].set_ylabel("Coefficient of Determination")
    c1 = mpatches.Patch(facecolor = "w", hatch="//", label="xgboost")
    c2 = mpatches.Patch(facecolor = "w", hatch="\\\\", label="lgbm")
    c3 = mpatches.Patch(facecolor = "w", hatch="||", label="extra tree")
    c4 = mpatches.Patch(facecolor = "w", hatch="--", label="catboost")
    axes[0].legend(handles = [c1,c2,c3,c4],ncol=2,loc=0,fontsize=11)
    
#     plt.tight_layout()
    plt.savefig("../figures/fig2_AutoML.pdf")
    plt.show()
monthly = df[(df["TimeScale"]=="Monthly")& (df["Gas"]=="Y") & (df["AOD"]=="Y")].reset_index(drop=True)
monthly_D = df[(df["TimeScale"]=="Monthly_D")& (df["Gas"]=="Y") & (df["AOD"]=="Y")].reset_index(drop=True)
monthly["diff"] = monthly["R2"] - monthly_D["R2"]
monthly<jupyter_output><empty_output><jupyter_text>LR performance<jupyter_code>df = pd.read_csv("./data/LR_wo_aod.csv")
df = df.rename(columns={"SpatialScale":"Region"})
#ax = sns.barplot(x="SpatialScale",y="R2",hue="Gas",data=df)
df['type'] = df.apply(lambda x: get_code(x['Gas'], x['AOD']), axis=1)

for y in ["R2"]:
    g = sns.catplot(x="Region",y=y,
                    hue="type", order=["E","S","W","N","C","A"],
                    col="TimeScale",
                    data=df,kind="bar")
    g.fig.set_size_inches(15,3.6)
    axes = g.axes.flatten()
    for i in range(3):
        axes[i].set_title("")
        axes[i].set_ylim(0,1)
    axes[0].set_ylabel("Coefficient of Determination")
#     plt.tight_layout()
    plt.savefig("../figures/fig2_LR.pdf")
    plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2283856159143076, 'fraction_numerical': 0.01568477429227238, 'mean_word_length': 3.6530249110320283, 'pattern_counts': {'":': 6, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '567718', 'license': 'MIT', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1051, 'n_words': 139, 'path': '3_scripts_for_figures/fig2_plotting_performance.ipynb', 'repo_name': 'zzheng93/code_DSI_India_AutoML', 'size': '2614'}