kliff.transforms.property_transforms

class kliff.transforms.property_transforms.PropertyTransform(property_key='energy', keep_original=False)[source]

A property transform is a function that maps a property of a configuration to a transformed property. For example, current property transforms include normalization of the energy and forces.

keep_original

If True, the original property values are kept in the configuration object. Otherwise, the original property values are discarded.

original_values

A map that stores the original property values of configurations. It stores list of property values for each configuration.

property_key

The key of the property to be transformed.

property keep_original
transform(dataset)[source]

Transform the property of a configuration.

Parameters:

dataset (Union[List[Configuration], Dataset]) – A list of configurations or a dataset.

inverse(dataset)[source]

Inverse transform the property of a configuration.

Parameters:

dataset (Union[List[Configuration], Dataset]) – A list of configurations or a dataset.

static get_configuration_list(dataset)[source]

Get a list of configurations from a dataset. This method ensures constant API for any arbitrary dataset. It is expected that this method will maintain the order of the Configurations in the dataset. Tihs enqures the inverse property mapping is done correctly.

Parameters:

dataset (Union[List[Configuration], Dataset]) – A list of configurations or a dataset.

Return type:

List[Configuration]

Returns:

A list of configurations.

class kliff.transforms.property_transforms.NormalizedPropertyTransform(property_key='energy', keep_original=False)[source]

Normalize the property of a configuration to zero mean and unit variance. .. math:

x' = \frac{x - \mu}{\sigma}
transform(dataset)[source]

Transform the property of a configuration.

Parameters:

dataset (Union[List[Configuration], Dataset]) – A list of configurations or a dataset.

inverse(dataset)[source]

Inverse transform the property of a configuration.

Parameters:

dataset (Union[List[Configuration], Dataset]) – A list of configurations or a dataset.

class kliff.transforms.property_transforms.RMSNormalizePropertyTransform(property_key='forces', keep_original=False)[source]

Normalize the property of a configuration to using the root mean square of the property. It is useful for normalizing oscillators properties, usually because mean for such properties is zero.

x' = \frac{x}{\sqrt{\frac{1}{N}\sum_{i=1}^N x_i^2}}

transform(dataset)[source]

Transform the property of a configuration.

Parameters:

dataset (Union[List[Configuration], Dataset]) – A list of configurations or a dataset.

inverse(dataset)[source]

Inverse transform the property of a configuration.

Parameters:

dataset (Union[List[Configuration], Dataset]) – A list of configurations or a dataset.

class kliff.transforms.property_transforms.RMSMagnitudeNormalizePropertyTransform(property_key='forces', keep_original=False)[source]

Normalize the property of a configuration using the root mean square of the magnitude of the property. This method is useful for normalizing forces.

x' = \frac{x}{\sqrt{\frac{1}{N}\sum_{i=1}^N \|x_i\|^2}}

transform(dataset)[source]

Transform the property of a configuration.

Parameters:

dataset (Union[List[Configuration], Dataset]) – A list of configurations or a dataset.

inverse(dataset)[source]

Inverse transform the property of a configuration.

Parameters:

dataset (Union[List[Configuration], Dataset]) – A list of configurations or a dataset.

exception kliff.transforms.property_transforms.PropertyTransformError(msg)[source]