Scaler

https://codecov.io/gh/metatensor/metatrain/branch/main/graph/badge.svg?component=scaler

Maintained by @pfebrer.

The scaler is a simple model that computes per-target and per-property scaling factors. It is meant to be used as a preprocessing step for other architectures, so that targets are standardized before being fed to the main model.

See Target scaling for more details.

Installation

To install this architecture along with the metatrain package, run:

pip install metatrain[scaler]

where the square brackets indicate that you want to install the optional dependencies required for scaler.

Default Hyperparameters

The description of all the hyperparameters used in scaler is provided further down this page. However, here we provide you with a yaml file containing all the default hyperparameters, which might be convenient as a starting point to create your own hyperparameter files:

architecture:
  name: scaler
  model:
    densify_atomic_basis: true
  training:
    fixed_weights: {}
    additive_models: []
    batch_size: null
    per_structure_targets: []
    distributed_port: 39591
    num_workers: null

Model hyperparameters

The parameters that go under the architecture.model section of the config file are the following:

ModelHypers.densify_atomic_basis: bool = True

Whether to densify the atomic basis targets when computing the scaling weights. This can only be done if the target is loaded from a DiskDataset.

Most models will require the scaler to work with the densified atomic basis.

Trainer hyperparameters

The parameters that go under the architecture.trainer section of the config file are the following:

TrainerHypers.fixed_weights: Dict[str, float | Dict[int, float]] = {}

Weights for target scaling.

This is passed to the fixed_weights argument of Scaler.train_model, see its documentation to understand exactly what to pass here.

TrainerHypers.additive_models: list[str] = []

List of checkpoint files to load additive models from.

The contribution from these models will be subtracted from the targets before computing the scales.

TrainerHypers.batch_size: int | None = None

Number of structures to accumulate at a time. This only affects memory usage, not the resulting scales, since the scaler is a deterministic modelrather than an iterative optimization. Defaults to the size of the smallest training dataset.

TrainerHypers.per_structure_targets: list[str] = []

Target names that should be treated as per-structure quantities and therefore not divided by the number of atoms.

TrainerHypers.distributed_port: int = 39591

Port for distributed communication among processes

TrainerHypers.num_workers: int | None = None

Number of workers for data loading. If not provided, it is set automatically.

References