xnn.common.data.hub.materials_project.MultiFidelityBandGapBuilder#
- class xnn.common.data.hub.materials_project.MultiFidelityBandGapBuilder[source]#
Bases:
DatasetBuilderBuilder for the multi-fidelity band gaps of Materials Project crystals (PBE, GLLB-SC, HSE, SCAN).
- FIDELITIES = ('pbe', 'gllb-sc', 'hse', 'scan')#
The fidelities, in the order of the state labels of MatGL’s pretrained band-gap model.
- load(*, split=None, cache_dir, fidelities=('pbe', 'gllb-sc', 'hse', 'scan'), train_fraction=0.8, val_fraction=0.1, seed=0, return_info=False, quiet=False)[source]#
Download, parse and split the band gaps.
Every label is one structure dict: the same crystal appears once per fidelity that has its band gap, as in the paper.
- Parameters:
split (str or None) –
Nonereturns{"train", "val", "test"};"train"/"val"/"test"that split;"all"every label.cache_dir (pathlib.Path) – Base cache directory; the files go to
cache_dir/"multifidelity_band_gap".fidelities (sequence of str, optional) – The fidelities to load, from
"pbe","gllb-sc","hse"and"scan". A structure’sstateis the position of its fidelity in this sequence; the default order is that of MatGL’s pretrained model.train_fraction (float, optional) – Split fractions, drawn within every fidelity separately, by default 0.8 and 0.1 (the paper’s).
val_fraction (float, optional) – Split fractions, drawn within every fidelity separately, by default 0.8 and 0.1 (the paper’s).
seed (int, optional) – Seed of the random split, by default 0.
return_info (bool, optional) – Add
info = {"material_id": ..., "fidelity": ...}to every structure.quiet (bool, optional) – Suppress download progress output.
- Returns:
dict of {str – Structure dicts with
pos,atomic_numbers,cell,pbc,properties(the band gap in eV) andstate(the fidelity label).- Return type:
- Raises:
ValueError – For an unknown fidelity or
split.