Parameter

class nyx.core.parameter.Parameter[source]

Bases: Module

A trainable physical parameter with an explicit characteristic scale.

Variables:
  • factor (jax.Array) – The only pytree leaf; O(1) for a well-chosen scale.

  • scale (float) – Characteristic scale in the unconstrained space, static for JIT. Change it via autoscale().

  • per_obs (bool) – Whether the parameter carries a leading (nobs, ...) axis after tile_per_obs().

  • frozen (bool) – Whether the parameter is excluded from optimization.

  • transform (str or None) – None (unconstrained), 'log' or 'softplus' for a positive quantity, or 'tanh' for one confined to (-1, 1).

Attributes Summary

dvalue_dfactor

d value / d factor, elementwise; scale when untransformed.

factor

frozen

per_obs

scale

transform

value

Physical value transform(factor * scale).

Methods Summary

freeze()

Return a copy with frozen=True.

from_value(value[, scale, per_obs, frozen, ...])

Construct from a physical value.

unfreeze()

Return a copy with frozen=False.

Attributes Documentation

dvalue_dfactor

d value / d factor, elementwise; scale when untransformed.

factor = <dataclasses._MISSING_TYPE object>
frozen = False
per_obs = False
scale = 1.0
transform = None
value

Physical value transform(factor * scale).

Methods Documentation

freeze()[source]

Return a copy with frozen=True.

classmethod from_value(value, scale=None, per_obs=False, frozen=False, transform=None)[source]

Construct from a physical value.

Parameters:
  • value (array-like) – Physical value; must lie in the domain of transform.

  • scale (float or None) – Characteristic scale. When None, 10**floor(log10(max|value|)) of the unconstrained value; 1.0 if that is zero or transform is set.

  • per_obs (bool)

  • frozen (bool)

  • transform (str or None)

Return type:

Parameter

Raises:

ValueError – If transform is unknown, or value lies outside its domain.

unfreeze()[source]

Return a copy with frozen=False.

__init__(factor, scale=1.0, per_obs=False, frozen=False, transform=None)
static __new__(cls, *args, **kwargs)