Matbench Dielectric Dataset¶
Exploratory Data Analysis (EDA). MPContribs link
# make-assets supplies matminer
%pip install "pymatviz[make-assets]"
from typing import get_args
import kemio
from kemio.options import CrystalSystem
from matminer.datasets import load_dataset
from tqdm import tqdm
import pymatviz as pmv
__author__ = "Janosh Riebesell"
__date__ = "2022-03-19"
df_diel = load_dataset("matbench_dielectric")
df_diel[["spg_symbol", "spg_num"]] = [
struct.get_space_group_info() for struct in tqdm(df_diel["structure"])
]
df_diel["crystal_system"] = df_diel["spg_num"].map(kemio.crystal_system)
df_diel["volume"] = df_diel["structure"].map(lambda cryst: cryst.volume)
df_diel["formula"] = df_diel["structure"].map(lambda cryst: cryst.formula)
title = "Elements in Matbench Dielectric"
pmv.ptable_heatmap(df_diel["formula"], log=True, color_bar={"title": title}).show()
_ = df_diel.hist(bins=80, log=True, figsize=(20, 4), layout=(1, 3))
pmv.spacegroup_bar_plot(df_diel["spg_num"])
pmv.spacegroup_sunburst(df_diel["spg_num"], label_text="label+percent")
# Refractive index distribution by crystal system
crystal_systems = get_args(CrystalSystem) # ordered triclinic to cubic
pmv.box_plot(
[
{"y": df_group["n"], "label": cry_sys}
for cry_sys, df_group in sorted(
df_diel.groupby("crystal_system"),
key=lambda x: crystal_systems.index(x[0]),
)
],
kind="violin",
title="Refractive index distribution by crystal system",
show_legend=False,
y_axis={"label": "Refractive index n"},
)