Transforms: Squash Shapes and Axis Warps
Quick links
BoundTransform
from jaxhybridmodels.transforms import BoundTransform · also re-exported as jaxhybridmodels.BoundTransform
BoundTransform(
forward: ForwardRef('Callable[[Array], Array]'),
inverse: ForwardRef('Callable[[Array], Array]'),
inverse_slope: ForwardRef('Callable[[Array], Array]'),
knee: ForwardRef('float'),
)A squash from the whole real line into (0, 1), with its inverse and metadata.
Attributes
| Field | Type | Description |
|---|---|---|
forward | Callable | R -> (0, 1). Applied by from_latent on the way from latent to physical. |
inverse | Callable | (0, 1) -> R. Applied by to_latent on the way back. |
inverse_slope | Callable | d(inverse)/ds. Builds the linear continuation that keeps to_latent differentiable for inputs that fall outside the box. |
knee | float | The latent at which forward reaches 0.95, where the physical value enters the outer 5% of its box. Default for BoundScaler.z_knee. It must come from the transform: reusing sigmoid's 2.944 for softsign would start charging at 12.5% from the bound instead of 5%. |
BOUND_TRANSFORMS
from jaxhybridmodels.transforms import BOUND_TRANSFORMS · also re-exported as jaxhybridmodels.BOUND_TRANSFORMS
BOUND_TRANSFORMS = {
'algebraic': BoundTransform
'sigmoid': BoundTransform
'softsign': BoundTransform
}dict() -> new empty dictionary
dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)
register_bound_transform()
from jaxhybridmodels.transforms import register_bound_transform · also re-exported as jaxhybridmodels.register_bound_transform
register_bound_transform(name: 'str', transform: 'BoundTransform') -> 'None'Register a squash under name for use by BoundScaler.
Mirrors register_solver. A scaler stores only the name, so a custom transform must be registered before a saved scaler that references it can be rebuilt. Re-registering an existing name overwrites without warning.
Warp
from jaxhybridmodels.transforms import Warp · also re-exported as jaxhybridmodels.Warp
Warp(
forward: ForwardRef('Callable[[ArrayLike], Array]'),
inverse: ForwardRef('Callable[[ArrayLike], Array]'),
requires_positive: ForwardRef('bool'),
)A monotone change of coordinate applied to the physical axis before normalising.
The warp runs first, then the box is normalised to [0, 1] in warped coordinates, then the transform's inverse takes it to the latent.
Attributes
| Field | Type | Description |
|---|---|---|
forward | Callable | Physical to warped coordinate. Must accept a Python float as well as an array, because warp_bounds calls it on the static box edges when a scaler is constructed. |
inverse | Callable | Warped coordinate back to physical. Must invert forward exactly on the declared box. |
requires_positive | bool | Whether the warp is undefined at or below zero. Checked against the declared bounds at construction, where it raises a useful error rather than a silent nan inside a compiled solve. |
WARPS
from jaxhybridmodels.transforms import WARPS · also re-exported as jaxhybridmodels.WARPS
WARPS = {
'linear': Warp
'log': Warp
'log10': Warp
}dict() -> new empty dictionary
dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)
register_warp()
from jaxhybridmodels.transforms import register_warp · also re-exported as jaxhybridmodels.register_warp
register_warp(name: 'str', warp: 'Warp') -> 'None'Register an axis warp under name for use by BoundScaler.
Same contract as register_bound_transform. A warp must be monotone on the declared box and inverse must undo forward there, or the scaler's round trip stops being the identity.