nessai.reparameterisations.base#

Base reparameterisation

Classes#

Reparameterisation

Base object for reparameterisations.

Module Contents#

class nessai.reparameterisations.base.Reparameterisation(input_parameters=None, output_parameters=None, persistent_parameters=None, auxiliary_parameters=None, prior_bounds=None, rng=None, inverse_input_parameters=None, parameters=None)#

Base object for reparameterisations.

Parameters:
input_parametersstr or list

Names of the parameters required in the forward direction.

output_parametersstr or list, optional

Names of the parameters produced in the prime space. If None, will be set to the same as input_parameters with ‘_prime’ appended.

persistent_parametersstr or list, optional

Subset of input_parameters that should remain exposed in the flow-facing parameter set after this reparameterisation.

auxiliary_parametersstr or list, optional

Name of any auxiliary parameters that are made available in x-space after the reparameterisation. These parameters are not required for the forward pass but may be used in the inverse pass. Defaults to None.

prior_boundslist, dict or None

Prior bounds for the parameter(s).

rng: np.random.Generator, optional

Random number generator to use for any random operations in the reparameterisation. If None, a new default_rng will be used.

inverse_input_parametersstr or list, optional

Name of any parameters that are required for the inverse reparameterisation.

parametersstr or list, optional

Alias for input_parameters.

property x_input_parameters#

Resolved x-space forward inputs.

property x_prime_input_parameters#

Resolved x’-space forward inputs.

property prime_input_parameters#

Compatibility alias for x_prime_input_parameters.

property x_output_parameters#

All x-space parameters available after this reparameterisation.

property x_persistent_parameters#

Resolved persistent x-space inputs.

property x_prime_persistent_parameters#

Resolved persistent x’-space inputs.

property x_inverse_input_parameters#

Resolved x-space inverse inputs.

property x_prime_inverse_input_parameters#

Resolved x’-space inverse inputs.

property parameters#

Compatibility alias for input_parameters.

property name#

Unique name of the reparameterisations

resolve_forward_input_spaces(available_parameters, available_prime_parameters)#

Resolve forward inputs against x and prime namespaces.

resolve_inverse_input_spaces(available_parameters, available_prime_parameters)#

Resolve inverse inputs against x and prime namespaces.

get_parameter_value(parameter, x, x_prime=None)#

Get the current value for an input parameter.

Returns the value from x or x_prime depending on where the parameter is defined.

set_parameter_value(parameter, value, x, x_prime=None)#

Set the reconstructed value for an input parameter.

Sets the value in x or x_prime depending on where the parameter is defined.

abstract reparameterise(x, x_prime, log_j)#

Apply the reparameterisation to convert from x-space to x’-space.

Parameters:
xstructured array

Array of inputs

x_primestructured array

Array to be update

log_jarray_like

Log jacobian to be updated

Returns:
x, x_primestructured arrays

Update version of the x and x_prime arrays

log_jarray_like

Updated log Jacobian determinant

abstract inverse_reparameterise(x, x_prime, log_j)#

Apply the reparameterisation to convert from x-space to x’-space

Parameters:
xstructured array

Array

x_primestructured array

Array to be update

log_jarray_like

Log jacobian to be updated

Returns:
x, x_primestructured arrays

Update version of the x and x_prime arrays

log_jarray_like

Updated log Jacobian determinant

update(x, x_prime=None)#

Update the reparameterisation given some points.

Does nothing by default.

reset()#

Reset the reparameterisation.

Does nothing by default.