|
8 | 8 |
|
9 | 9 | import numpy as np
|
10 | 10 | import pandas as pd
|
| 11 | +from pymatviz.io import df_to_pdf |
11 | 12 | from sklearn.dummy import DummyClassifier
|
12 | 13 |
|
13 | 14 | from matbench_discovery import PDF_FIGS, SITE_FIGS
|
14 | 15 | from matbench_discovery.data import DATA_FILES, df_wbm
|
15 | 16 | from matbench_discovery.metrics import stable_metrics
|
16 | 17 | from matbench_discovery.models import MODEL_METADATA
|
17 |
| -from matbench_discovery.plots import df_to_pdf, df_to_svelte_table |
| 18 | +from matbench_discovery.plots import df_to_svelte_table |
18 | 19 | from matbench_discovery.preds import df_metrics, df_metrics_10k, each_true_col
|
19 | 20 |
|
20 | 21 | __author__ = "Janosh Riebesell"
|
|
25 | 26 | "M3GNet→MEGNet": "M3GNet",
|
26 | 27 | "CHGNet→MEGNet": "CHGNet",
|
27 | 28 | }
|
28 |
| -train_size_col = "training size" |
| 29 | +train_size_col = "Training Size" |
29 | 30 | df_metrics.loc[train_size_col] = df_metrics_10k.loc[train_size_col] = ""
|
30 | 31 | for model in df_metrics:
|
31 | 32 | model_name = name_map.get(model, model)
|
|
62 | 63 | df_metrics_10k["Dummy"] = dummy_metrics
|
63 | 64 |
|
64 | 65 |
|
65 |
| -# %% for each model this ontology dict specifies (training type, test type, model class) |
| 66 | +# %% for each model this ontology dict specifies (training type, test type, model type) |
66 | 67 | ontology = {
|
67 | 68 | "ALIGNN": ("RS2RE", "IS2RE", "GNN"),
|
68 | 69 | # "ALIGNN Pretrained": ("RS2RE", "IS2RE", "GNN"),
|
|
80 | 81 | "CHGNet→MEGNet": ("S2EFSM", "IS2RE-SR", "UIP-GNN"),
|
81 | 82 | "Dummy": ("", "", ""),
|
82 | 83 | }
|
83 |
| -ontology_cols = ["Trained", "Deployed", "Model Class"] |
| 84 | +ontology_cols = ["Trained", "Deployed", model_type_col := "Model Type"] |
84 | 85 | df_ont = pd.DataFrame(ontology, index=ontology_cols)
|
85 | 86 | # RS2RE = relaxed structure to relaxed energy
|
86 | 87 | # RP2RE = relaxed prototype to predicted energy
|
|
104 | 105 | make_uip_megnet_comparison = False
|
105 | 106 | show_cols = (
|
106 | 107 | f"F1,DAF,Precision,Accuracy,TPR,TNR,MAE,RMSE,{R2_col},"
|
107 |
| - "training size,Model Class".split(",") |
| 108 | + f"{train_size_col},{model_type_col}".split(",") |
108 | 109 | )
|
109 | 110 |
|
110 | 111 | for label, df in (("-first-10k", df_metrics_10k), ("", df_metrics)):
|
|
160 | 161 | )
|
161 | 162 | try:
|
162 | 163 | df_to_pdf(styler, f"{PDF_FIGS}/metrics-table{label}.pdf")
|
163 |
| - except ImportError as exc: |
| 164 | + except (ImportError, RuntimeError) as exc: |
164 | 165 | print(f"df_to_pdf failed: {exc}")
|
165 | 166 |
|
166 | 167 |
|
|
0 commit comments