hierarchical_flow_tools.models

Provides some out-of-the-box use of hierarchical-flow-tools with other packages.

Module Contents

Classes

NessaiModel

Model class for use with the nessai package for parameter estimation.

class hierarchical_flow_tools.models.NessaiModel(names: list, bounds: list, flow_likelihood: hierarchical_flow_tools.likelihood.FlowLikelihood)

Bases: nessai.model.Model

Model class for use with the nessai package for parameter estimation.

Parameters:
nameslist

A list of label strings for each parameter.

boundsdict

A dict of the prior bounds, assuming uniform priors on all parameters.

flowlikeFlowLikelihood

The FlowLikelihood class to use for the log_likelihood calls.

unpack_live_point(x)

Unpacks a live point to a torch tensor for use in the log_likelihood.

Parameters:
xstructured_array

The live points to be unpacked into a torch tensor.

Returns:
Tensor

The unpacked live points.

log_prior(x)

Returns log of prior given a live point assuming uniform priors on each parameter.

Parameters:
xstructured array

the live points for which to evaluate the prior probability.

Returns:
ndarray

the log_prior probabilities

log_likelihood(x)

Log likelihood wrapper that calls the FlowLikelihood.log_likelihood method.

Parameters:
xstructured array

the live points for which to evaluate the prior probability.

Returns:
ndarray

The resulting log_likelihoods, cast to a numpy array for compatibility with nessai.