dantis.utilsο
Classes
|
Utility to extract defaults from a callable and validate/complete user supplied hyperparameters. |
Exceptions
|
- class dantis.utils.ParameterManagement(function)[source]ο
Utility to extract defaults from a callable and validate/complete user supplied hyperparameters.
Behavior: - get_parameter_function extracts parameters that have explicit defaults
(skips parameters with inspect._empty).
check_hyperparameter_type attempts to cast user values to the type of the default value when possible (safe casts only).
complete_parameters returns a new dict merging defaults and user provided values (does not mutate the stored defaults).
- __get_parameter_correct_type(param_key, param_value)ο
Attempt to coerce param_value to the type of the default for param_key. If the default is None or coercion is unsafe, the original value is returned.
- check_hyperparameter_type(user_parameters: dict) dict[source]ο
Return a new dict with user parameters coerced to the types of the defaults where possible. Unknown keys are passed through unchanged.