xnn.common.data.hub.base.load_dataset#

xnn.common.data.hub.base.load_dataset(name, *, split=None, cutoff=None, cache_dir=None, **kwargs)[source]#

Download and preprocess an upstream dataset in one call.

Looks up the builder registered under name and returns its data as xnn structure dicts, optionally wrapped as ready-to-train AtomicDataset objects.

Files are downloaded (and cached, verified by MD5) under cache_dir / name – by default the repository’s datasets/ directory, so re-running is instant and offline. See default_cache_dir().

Parameters:
  • name (str) – Registered dataset name; see list_datasets() (e.g. "rmd17").

  • split (str, optional) – Which split to return. None (default) returns a mapping {split_name: data}; a name (e.g. "train") returns just that split. Available splits are dataset-specific.

  • cutoff (float, optional) – If given, each returned split is wrapped in an AtomicDataset built with this neighbor-list cutoff (ready for a DataLoader). If omitted, raw lists of structure dicts are returned.

  • cache_dir (str or pathlib.Path, optional) – Base cache directory. Defaults to default_cache_dir().

  • **kwargs – Forwarded to the builder’s DatasetBuilder.load() (e.g. rMD17’s molecule, fold, units).

Returns:

Structure-dict lists (or AtomicDatasets when cutoff is set), as a per-split mapping when split is None else for the single split.

Return type:

dict or list or AtomicDataset

Examples

>>> from xnn.common.data import load_dataset
>>> splits = load_dataset("rmd17", molecule="aspirin")      # {"train","test"}
>>> train = load_dataset("rmd17", molecule="aspirin", split="train", cutoff=5.0)