Optimization#

class Transform[source]#
class SigmoidTransform(lower, upper)[source]#

Sigmoid transformation.

Parameters:
class SoftplusTransform(lower)[source]#

Softplus transformation.

Parameters:

lower (Array | ndarray | bool | number | bool | int | float | complex)

class NegSoftplusTransform(upper)[source]#

Negative softplus transformation.

Parameters:

upper (Array | ndarray | bool | number | bool | int | float | complex)

class AffineTransform(scale, shift)[source]#
Parameters:
class ChainTransform(transforms)[source]#

Chaining together multiple transformations

Parameters:

transforms (Sequence[Transform])

class MaskedTransform(mask, transform)[source]#
Parameters:
class CustomTransform(forward_fn, inverse_fn)[source]#

Custom transformation

Parameters:
class ParamTransform(tf_dict)[source]#

Parameter transformation utility.

This class is used to transform parameters usually from an unconstrained space to a constrained space and back (bacause most biophysical parameter are bounded). The user can specify a PyTree of transforms that are applied to the parameters.

Parameters:

tf_dict (List[Dict[str, Transform]] | Transform)

tf_dict#

A PyTree of transforms for each parameter.

forward(params)[source]#

Pushes unconstrained parameters through a tf such that they fit the interval.

Parameters:

params (List[Dict[str, Array | ndarray | bool | number | bool | int | float | complex]] | Array | ndarray | bool | number | bool | int | float | complex) – A list of dictionaries (or any PyTree) with unconstrained parameters.

Returns:

A list of dictionaries (or any PyTree) with transformed parameters.

Return type:

Dict[str, Array]

inverse(params)[source]#

Takes parameters from within the interval and makes them unconstrained.

Parameters:

params (List[Dict[str, Array | ndarray | bool | number | bool | int | float | complex]] | Array | ndarray | bool | number | bool | int | float | complex) – A list of dictionaries (or any PyTree) with transformed parameters.

Returns:

A list of dictionaries (or any PyTree) with unconstrained parameters.

Return type:

Dict[str, Array]

class TypeOptimizer(optimizer, optimizer_args, opt_params)[source]#

optax wrapper which allows different argument values for different params.

Parameters:
init(opt_params)[source]#

Initialize the optimizers. Equivalent to optax.optimizers.init().

Parameters:

opt_params (List[Dict[str, Array]])

Return type:

List

update(gradient, opt_state)[source]#

Update the optimizers. Equivalent to optax.optimizers.update().

Parameters:
Return type:

Tuple[List, List]