Skip to content

parameterspace.transformations.base

BaseTransformation

Base class defining the API of a transformation.

from_dict(json_dict) staticmethod

[summary]

Source code in parameterspace/transformations/base.py
@staticmethod
def from_dict(json_dict: dict):
    """
    [summary]
    """
    transformation_class = json_dict["class_name"]
    module_str, class_str = transformation_class.rsplit(".", 1)
    module = importlib.import_module(module_str)
    model_class = getattr(module, class_str)
    return model_class(*json_dict["init_args"], **json_dict["init_kwargs"])

inverse(self, numerical_value)

Convert the numerical representation back to the true value with the proper type.

Parameters:

Name Type Description Default
numerical_value float

Transformed/Numerical representation of a value.

required

Returns:

Type Description
Any

The value corresponding to the given value. Type depends no the kind of transformation.

Source code in parameterspace/transformations/base.py
@abc.abstractmethod
def inverse(self, numerical_value: float) -> Any:
    """Convert the numerical representation back to the true value with the proper
    type.

    Args:
        numerical_value: Transformed/Numerical representation of a value.

    Returns:
        The value corresponding to the given value. Type depends no the kind of
        transformation.
    """

jacobian_factor(self, numerical_value)

Factor to correct the likelihood based on the non-linear transformation.

Parameters:

Name Type Description Default
numerical_value float

Transformed/Numerical representation of a value.

required

Returns:

Type Description
float

Jacobian factor to properly transform the likelihood.

Source code in parameterspace/transformations/base.py
def jacobian_factor(self, numerical_value: float) -> float:
    """Factor to correct the likelihood based on the non-linear transformation.

    Args:
        numerical_value: Transformed/Numerical representation of a value.

    Returns:
        Jacobian factor to properly transform the likelihood.
    """
    return 1.0

to_dict(self)

[summary]

Source code in parameterspace/transformations/base.py
def to_dict(self):
    """
    [summary]
    """
    json_dict = {
        "class_name": type(self).__module__ + "." + type(self).__qualname__,
        "init_args": self._init_args,
        "init_kwargs": self._init_kwargs,
    }
    return json_dict