pymixef.transforms module¶
Canonical constraints between optimizer and natural parameter scales.
- class pymixef.transforms.BoundedTransform(lower=0.0, upper=1.0)[source]¶
Bases:
TransformMap to the open interval
(lower, upper)using a logistic map.- Parameters:
lower (float)
upper (float)
- lower: float¶
- upper: float¶
- name: ClassVar[str] = 'bounded'¶
- forward(unconstrained)[source]¶
Map an unconstrained value to its natural scale.
- Parameters:
unconstrained (ArrayLike)
- Return type:
NDArray[float64]
- class pymixef.transforms.CholeskyCovarianceTransform(dimension)[source]¶
Bases:
TransformMap packed unconstrained Cholesky entries to an SPD covariance matrix.
- Parameters:
dimension (int)
- dimension: int¶
- name: ClassVar[str] = 'cholesky-covariance'¶
- property unconstrained_size: int¶
- forward(unconstrained)[source]¶
Map an unconstrained value to its natural scale.
- Parameters:
unconstrained (ArrayLike)
- Return type:
NDArray[float64]
- class pymixef.transforms.IdentityTransform[source]¶
Bases:
TransformNo constraint.
- name: ClassVar[str] = 'identity'¶
- forward(unconstrained)[source]¶
Map an unconstrained value to its natural scale.
- Parameters:
unconstrained (ArrayLike)
- Return type:
NDArray[float64]
- class pymixef.transforms.LogTransform[source]¶
Bases:
TransformStrictly-positive transform using
exp.- name: ClassVar[str] = 'log'¶
- forward(unconstrained)[source]¶
Map an unconstrained value to its natural scale.
- Parameters:
unconstrained (ArrayLike)
- Return type:
NDArray[float64]
- class pymixef.transforms.OrderedTransform[source]¶
Bases:
TransformMap a vector to a strictly increasing vector.
- name: ClassVar[str] = 'ordered'¶
- forward(unconstrained)[source]¶
Map an unconstrained value to its natural scale.
- Parameters:
unconstrained (ArrayLike)
- Return type:
NDArray[float64]
- class pymixef.transforms.SimplexTransform[source]¶
Bases:
TransformAdditive-log-ratio map from
R^(K-1)to aK-simplex.- name: ClassVar[str] = 'simplex'¶
- forward(unconstrained)[source]¶
Map an unconstrained value to its natural scale.
- Parameters:
unconstrained (ArrayLike)
- Return type:
NDArray[float64]
- class pymixef.transforms.SoftplusTransform[source]¶
Bases:
TransformSmooth strictly-positive transform with a near-linear upper tail.
- name: ClassVar[str] = 'softplus'¶
- forward(unconstrained)[source]¶
Map an unconstrained value to its natural scale.
- Parameters:
unconstrained (ArrayLike)
- Return type:
NDArray[float64]
- class pymixef.transforms.Transform[source]¶
Bases:
ABCAbstract optimizer-to-natural-scale transform.
- name: ClassVar[str]¶
- abstractmethod forward(unconstrained)[source]¶
Map an unconstrained value to its natural scale.
- Parameters:
unconstrained (ArrayLike)
- Return type:
NDArray[float64]
- abstractmethod inverse(natural)[source]¶
Map a natural-scale value to its unconstrained scale.
- Parameters:
natural (ArrayLike)
- Return type:
NDArray[float64]