Skip to content

Commit 856c173

Browse files
committed
change plotly template to plotly_dark
rename scripts/{precision_recall->cumulative_clf_metrics}.py set transparent paper_bgcolor set cum clf metrics config=dict(showTips=False, displayModeBar=False, scrollZoom=True)
1 parent 6e36278 commit 856c173

File tree

6 files changed

+36
-16
lines changed

6 files changed

+36
-16
lines changed

matbench_discovery/plots.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,14 @@
5555
dft="DFT",
5656
)
5757
px.defaults.labels = quantity_labels | model_labels
58-
pastel_layout = dict(
59-
colorway=px.colors.qualitative.Pastel, margin=dict(l=40, r=30, t=60, b=30)
58+
global_layout = dict(
59+
# colorway=px.colors.qualitative.Pastel,
60+
margin=dict(l=30, r=20, t=60, b=20),
61+
paper_bgcolor="rgba(0,0,0,0)",
62+
# plot_bgcolor="rgba(0,0,0,0)",
6063
)
61-
pio.templates["pastel"] = dict(layout=pastel_layout)
62-
pio.templates.default = "plotly_white+pastel"
64+
pio.templates["global"] = dict(layout=global_layout)
65+
pio.templates.default = "plotly_dark+global"
6366

6467
# https://github.com/plotly/Kaleido/issues/122#issuecomment-994906924
6568
# when seeing MathJax "loading" message in exported PDFs, try:
@@ -607,7 +610,7 @@ def cumulative_precision_recall(
607610
)
608611
fig.for_each_annotation(lambda a: a.update(text=""))
609612
fig.update_layout(legend=dict(title=""))
610-
fig.update_layout(showlegend=False)
613+
# fig.update_layout(showlegend=False)
611614

612615
return fig, df_cum
613616

readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ Matbench Discovery
1313

1414
</h4>
1515

16-
Matbench Discovery is an [interactive leaderboard](https://matbench-discovery.janosh.dev/figures) and associated [PyPI package](https://pypi.org/project/matbench-discovery) for benchmarking ML energy models on a task designed to closely emulate a real-world computational materials discovery workflow in which these models would be used for a pre-triaging step to determine how to allocate limited compute budget on DFT structure relaxations.
16+
Matbench Discovery is an [interactive leaderboard](https://matbench-discovery.janosh.dev/figures) and associated [PyPI package](https://pypi.org/project/matbench-discovery) for benchmarking ML energy models on a task designed to closely emulate a real-world computational materials discovery workflow. In it, these models take on the role of a triaging step to prior to DFT to determine how to allocate limited compute budget for structure relaxations.
1717

18-
We welcome contributions that add new models to the leaderboard through [GitHub PRs](https://github.com/janosh/matbench-discovery/pulls).
18+
We welcome contributions that add new models to the leaderboard through [GitHub PRs](https://github.com/janosh/matbench-discovery/pulls). See the [usage and contributing guide](site/src/routes/how-to-contribute/+page.md).
1919

2020
Several new energy models specifically designed to handle unrelaxed structures were published in 2021/22
2121

scripts/precision_recall.py scripts/cumulative_clf_metrics.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
show_optimal=True,
3737
)
3838

39-
title = f"{today} - Cumulative Precision and Recall for Stable Materials"
39+
title = f"{today} - Cumulative Precision, Recall and F1 Score for Stable Materials"
4040
# xlabel_cumulative = "Materials predicted stable sorted by hull distance"
4141
if backend == "matplotlib":
4242
fig.suptitle(title)
@@ -51,6 +51,11 @@
5151
img_path = f"{ROOT}/figures/{today}-precision-recall-curves"
5252
# if hasattr(fig, "write_image"):
5353
# fig.write_image(f"{img_path}.pdf")
54-
# fig.write_html(f"{img_path}.svelte", include_plotlyjs=False, full_html=False)
54+
# fig.write_html(
55+
# f"{img_path}.svelte",
56+
# include_plotlyjs=False,
57+
# full_html=False,
58+
# config=dict(showTips=False, displayModeBar=False, scrollZoom=True),
59+
# )
5560
# else:
5661
# fig.savefig(f"{img_path}.pdf")

site/src/routes/+page.svelte

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
<script lang="ts">
2-
import Plot from '$root/figures/2022-12-25-precision-recall-curves.svelte'
2+
import CumulativeMetricsPlot from '$root/figures/2022-12-25-precision-recall-curves.svelte'
33
import Readme from '$root/readme.md'
4+
import { onMount } from 'svelte'
5+
6+
onMount(() => {
7+
// make links to site/src/routes/ files deployment-compatible
8+
const site_links: NodeListOf<HTMLAnchorElement> = document.querySelectorAll(
9+
`a[href^='site/src/routes']`
10+
)
11+
for (const link of site_links) {
12+
link.href = link.href.replace(`/site/src/routes`, ``).split('/+page')[0]
13+
}
14+
})
415
</script>
516

617
<Readme />
718

819
{#if typeof document !== `undefined`}
9-
<Plot style="margin: 0 -5vw;" />
20+
<CumulativeMetricsPlot
21+
style="width: 90vw; transform: translateX(-45vw) translateX(min(25em, 45vw))"
22+
/>
1023
{/if}

site/src/routes/about-the-data/+page.svelte site/src/routes/about-the-test-set/+page.svelte

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99
1010
onMount(() => {
1111
for (const img of document.querySelectorAll(`img`)) {
12-
const src = img.getAttribute(`src`)
13-
if (figs[`../data/wbm/${src}`]) {
14-
img.src = figs[`../data/wbm/${src}`]
15-
}
12+
const src = `../data/wbm/${img.getAttribute(`src`)}`
13+
if (figs[src]) img.src = figs[src]
1614
}
1715
})
1816
</script>

site/src/routes/how-to-use/+page.svx site/src/routes/how-to-contribute/+page.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Installation
22

3-
The recommended way to use this benchmark is through the [PyPI Python package](https://pypi.org/project/matbench-discovery):
3+
The recommended way to use this benchmark is through its Python package [available onPyPI](https://pypi.org/project/matbench-discovery):
44

55
```zsh
66
pip install matbench-discovery
@@ -11,6 +11,7 @@ pip install matbench-discovery
1111
Here's an example script of how to download the training and test set files for training a new model, recording the results and submitting them via pull request to this benchmark:
1212

1313
<!-- TODO remove notest meta key once repo is public and file can be downloaded without token -->
14+
1415
```py notest
1516
from matbench_discovery.data import load_train_test
1617
from matbench_discovery.data import df_wbm

0 commit comments

Comments
 (0)