neural_lam.loss_weighting#
Utility functions for configuring state-feature loss weighting.
Functions#
|
Return the state feature weights as a list of floats in the order of the |
|
Return the state feature weights as a list of floats in the order of the |
|
Return the state feature weights as a list of floats in the order of the |
Module Contents#
- neural_lam.loss_weighting.get_manual_state_feature_weights(weighting_config: neural_lam.config.ManualStateFeatureWeighting, datastore: neural_lam.datastore.base.BaseDatastore) list[float][source]#
Return the state feature weights as a list of floats in the order of the state features in the datastore.
- Parameters:
weighting_config (ManualStateFeatureWeighting) – Configuration object containing the manual state feature weights.
datastore (BaseDatastore) – Datastore object containing the state features.
- Returns:
List of floats containing the state feature weights.
- Return type:
- Raises:
ValueError – If the set of feature names in
weighting_config.weightsdoes not match the state feature names in the datastore.
- neural_lam.loss_weighting.get_state_feature_weighting(config: neural_lam.config.NeuralLAMConfig, datastore: neural_lam.datastore.base.BaseDatastore) list[float][source]#
Return the state feature weights as a list of floats in the order of the state features in the datastore. The weights are determined based on the configuration in the NeuralLAMConfig object.
- Parameters:
config (NeuralLAMConfig) – Configuration object for neural-lam.
datastore (BaseDatastore) – Datastore object containing the state features.
- Returns:
List of floats containing the state feature weights.
- Return type:
- Raises:
NotImplementedError – If
config.training.state_feature_weightingis not a recognised weighting configuration type.
- neural_lam.loss_weighting.get_uniform_state_feature_weights(datastore: neural_lam.datastore.base.BaseDatastore) list[float][source]#
Return the state feature weights as a list of floats in the order of the state features in the datastore.
The weights are uniform, i.e. 1.0/n_features for each feature.
- Parameters:
datastore (BaseDatastore) – Datastore object containing the state features.
- Returns:
List of floats containing the state feature weights.
- Return type: