dantis.utils

Classes

ParameterManagement(function)

Utility to extract defaults from a callable and validate/complete user supplied hyperparameters.

Exceptions

SupervisedInputDataError([mensaje])

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.

complete_parameters(user_parameters: dict) dict[source]

Return a new dict where missing parameters are filled from defaults.

The stored _default_parameters is not mutated.

static get_parameter_function(function) dict[source]

Extract parameters with defaults from a callable’s signature.

Returns a dict mapping parameter name -> default value. Parameters with no default (inspect._empty) are skipped.

exception dantis.utils.SupervisedInputDataError(mensaje='En algoritmos supervisados es necesario proporcionar los datos de entrada y las etiquetas a predecir')[source]