nip.parameters.version.convert_hyper_param_dict#
- nip.parameters.version.convert_hyper_param_dict(hyper_param_dict: dict) dict [source]#
Convert an old hyper-parameter dictionary to a new one.
The specification and meaning of the hyper-parameter fields can change over time. However, sometimes we want to access hyper-parameter dictionaries that were created with an older version of the package. For example, we may want resume an old run, or re-run it with additional tests or logging.
This function is used to transform an old hyper-parameter dictionary to one which is compatible with the current version of the package. This is based on the version number of the package that was used to create the hyper-parameter dictionary, stored in the
_package_version
field of the dictionary.The way this works is by stepping through the versions of the package, applying conversion functions to the dictionary as needed. These conversion functions are stored in the
nip.parameters.version
module, registered with theregister_conversion_function
decorator.- Parameters:
hyper_param_dict (dict) – The old hyper-parameter dictionary.
- Returns:
new_hyper_param_dict (dict) – The new hyper-parameter dictionary, compatible with the current version of the package.
- Raises:
MultipleConversionFunctionsMatchError – If at some point in the conversion process, multiple conversion functions are found which match a version number.
ConversionFunctionNotFoundError – If at some point in the conversion process, no conversion function is found which matches a version number.