xnn.common.data.hub.qm7.QM7Builder#

class xnn.common.data.hub.qm7.QM7Builder[source]#

Bases: DatasetBuilder

Builder for QM7 (7165 molecules, atomization energies, five folds).

load(*, split=None, cache_dir, fold=1, units='eV', n_train=None, n_test=None, quiet=False)[source]#

Download and preprocess QM7.

Parameters:
  • split (str or None) – None returns {"train": ..., "test": ...} for the chosen fold; "train" / "test" returns that split; "all" returns every molecule in file order.

  • cache_dir (pathlib.Path) – Base cache directory; the file is stored under cache_dir/"qm7".

  • fold (int, optional) – Which of the five stratified folds (1-5) is the test set; the other four are the training set. Defaults to 1.

  • units (str, optional) – "eV" (default, with positions in Angstrom) or "kcal/mol" (energies as published, positions in Bohr).

  • n_train (int, optional) – Truncate the splits to their first n molecules.

  • n_test (int, optional) – Truncate the splits to their first n molecules.

  • quiet (bool, optional) – Suppress download progress output.

Returns:

dict of {str – Structure dicts with pos (N, 3), atomic_numbers (N,) and energy (the atomization energy).

Return type:

list of dict} or list of dict

Raises: