neural_lam.config#

Configuration dataclasses and helpers for Neural-LAM experiments.

Module Contents#

exception neural_lam.config.InvalidConfigError#

Bases: Exception

Raised when the Neural-LAM configuration file is invalid or malformed.

Initialize self. See help(type(self)) for accurate signature.

class neural_lam.config.DatastoreSelection#

Configuration for selecting a datastore to use with neural-lam.

kind#

The kind of datastore to use, currently mdp or npyfilesmeps are implemented.

Type:

str

config_path#

The path to the configuration file for the selected datastore, this is assumed to be relative to the configuration file for neural-lam.

Type:

str

config_path: str#
kind: str#
class neural_lam.config.ManualStateFeatureWeighting#

Configuration for weighting the state features in the loss function where the weights are manually specified.

weights#

Manual weights for the state features.

Type:

Dict[str, float]

weights: Dict[str, float]#
class neural_lam.config.NeuralLAMConfig#

Bases: dataclass_wizard.JSONWizard, dataclass_wizard.YAMLWizard

Configuration for the Neural-LAM model and training pipeline.

Loads and stores all settings needed to run Neural-LAM, including datastore selection and training hyperparameters. Serialisation and deserialisation from YAML/JSON is handled via dataclass_wizard.

datastore#

Configuration specifying which datastore backend to use and its associated settings.

Type:

DatastoreSelection

training#

Configuration for training the model, including loss function and feature-weighting strategy. Defaults to TrainingConfig().

Type:

TrainingConfig

datastore: DatastoreSelection#
training: TrainingConfig#
class neural_lam.config.OutputClamping#

Configuration for clamping the output of the model.

lower#

The minimum value to clamp each output feature to.

Type:

Dict[str, float]

upper#

The maximum value to clamp each output feature to.

Type:

Dict[str, float]

lower: Dict[str, float]#
upper: Dict[str, float]#
class neural_lam.config.TrainingConfig#

Configuration related to training neural-lam

state_feature_weighting#

UnformFeatureWeighting]

The method to use for weighting the state features in the loss function. Defaults to uniform weighting (UnformFeatureWeighting, i.e. all features are weighted equally).

Type:

Union[ManualStateFeatureWeighting,

output_clamping: OutputClamping#
state_feature_weighting: ManualStateFeatureWeighting | UniformFeatureWeighting#
class neural_lam.config.UniformFeatureWeighting#

Configuration for weighting the state features in the loss function where all state features are weighted equally.

neural_lam.config.load_config_and_datastore(config_path: str) tuple[NeuralLAMConfig, neural_lam.datastore.MDPDatastore | neural_lam.datastore.NpyFilesDatastoreMEPS]#

Load the neural-lam configuration and the datastore specified in the configuration.

Parameters:

config_path (str) – Path to the Neural-LAM configuration file.

Returns:

The Neural-LAM configuration and the loaded datastore.

Return type:

tuple[NeuralLAMConfig, Union[MDPDatastore, NpyFilesDatastoreMEPS]]