Parameters#
See also
Constraints documents the LinearConstraint
system and the Parameters.get_constraints() hook used to declare
adding-up relationships between parameters.
This class is the base class for all parameter classes. It contains the common methods for all parameter classes.
Constructor#
|
A class for handling parameters for the MacroStat model. |
Initialization and Loading#
|
Initialize the parameters from a JSON file. |
|
Initialize the parameters from an Excel file. |
|
Initialize the parameters from a CSV file. |
Serialization / IO#
|
Convert the parameters to a JSON file. |
|
Convert the parameters to an Excel file. |
|
Convert the parameters to a CSV file. |
Parameter Management#
|
Set the bounds for a single parameter |
|
Set the notation for a single parameter. |
|
Set the unit for a single parameter. |
|
Verify that the bounds are valid. |
|
Verify that the parameters are within the bounds. |
Constraints#
|
Return parameter constraints for this model. |
|
Verify that declared constraints are well-formed. |
|
Enforce all constraints by adjusting derived parameter values. |
|
Return scalar parameter names excluding derived (constrained) ones. |
Notes#
The Parameters class is designed to handle both model parameters and hyperparameters in a structured way. It provides methods for loading parameters from various file formats (JSON, Excel, CSV) and includes validation to ensure parameters are within specified bounds.
Example#
A typical workflow for parameters might look like:
>>> params = Parameters()
>>> params['alpha'] = 0.5
>>> params.to_json('parameters.json')