|
11 | 11 |
|
12 | 12 | from matbench_discovery import ROOT, STATIC, today
|
13 | 13 | from matbench_discovery.plots import hist_classified_stable_vs_hull_dist, plt
|
14 |
| -from matbench_discovery.preds import ( |
15 |
| - df_metrics, |
16 |
| - df_wbm, |
17 |
| - e_form_col, |
18 |
| - each_true_col, |
19 |
| - models, |
20 |
| -) |
| 14 | +from matbench_discovery.preds import df_metrics, df_wbm, e_form_col, each_true_col |
21 | 15 |
|
22 | 16 | __author__ = "Janosh Riebesell"
|
23 | 17 | __date__ = "2022-12-01"
|
|
28 | 22 | e_form_preds = "e_form_per_atom_pred"
|
29 | 23 | each_pred_col = "e_above_hull_pred"
|
30 | 24 | facet_col = "Model"
|
| 25 | +models = list(df_metrics) |
| 26 | +# models = df_metrics.T.MAE.nsmallest(6).index # top 6 models by MAE |
31 | 27 |
|
32 | 28 | df_melt = df_wbm.melt(
|
33 | 29 | id_vars=hover_cols,
|
34 |
| - # value_vars=models, |
35 |
| - value_vars=list(df_metrics), |
| 30 | + value_vars=models, |
36 | 31 | var_name=facet_col,
|
37 | 32 | value_name=e_form_preds,
|
38 | 33 | )
|
|
96 | 91 | )
|
97 | 92 | anno.text = f"{model_name} · {F1=:.2f} · {FPR=:.2f} · {FNR=:.2f} · {DAF=:.2f}"
|
98 | 93 |
|
99 |
| - # horizontal legend at the top |
100 |
| - legend = dict(yanchor="top", y=1, xanchor="right", x=1) |
101 |
| - fig.update_layout(legend=legend, margin=dict(t=50, b=30, l=40, r=0)) |
| 94 | + fig.layout.margin.update(t=50, b=30, l=40, r=0) |
| 95 | + fig.layout.legend.update( |
| 96 | + y=1.15, xanchor="center", x=0.5, bgcolor="rgba(0,0,0,0)", orientation="h" |
| 97 | + ) |
102 | 98 | fig.update_yaxes(range=[0, 3_000], title_text=None)
|
103 | 99 |
|
104 | 100 | # for trace in fig.data:
|
|
115 | 111 | # save_fig(fig, f"{FIGS}/{img_name}.svelte")
|
116 | 112 | n_models = len(fig.layout.annotations)
|
117 | 113 | save_fig(fig, f"{STATIC}/{img_name}.webp", scale=3, height=100 * n_models)
|
118 |
| -save_fig(fig, f"{ROOT}/tmp/figures/{img_name}.pdf", height=600, width=600) |
| 114 | +save_fig(fig, f"{ROOT}/tmp/figures/{img_name}.pdf", height=550, width=600) |
0 commit comments