aspire.flows.base#

Attributes#

Classes#

Flow

Base class for all flows.

Module Contents#

aspire.flows.base.logger[source]#
class aspire.flows.base.Flow(dims, device, data_transform=None)[source]#

Base class for all flows.

Parameters:
  • dims (int) – The number of dimensions.

  • device (Any) – The device to use for computations. Can be None for backends that do not handle devices explicitly.

  • data_transform (BaseTransform, optional) – A transform to apply to the data before fitting the flow. If None, the identity transform is used.

xp: Any = None[source]#
dims[source]#
device[source]#
data_transform = None[source]#
abstractmethod log_prob(x)[source]#
abstractmethod sample(n_samples)[source]#
abstractmethod sample_and_log_prob(n_samples)[source]#
abstractmethod fit(samples, **kwargs)[source]#
Return type:

aspire.history.FlowHistory

fit_data_transform(x)[source]#
rescale(x)[source]#
inverse_rescale(x)[source]#
config_dict()[source]#

Return a dictionary of the configuration of the flow.

This can be used to recreate the flow by passing the dictionary as keyword arguments to the constructor.

This is automatically populated with the arguments passed to the constructor.

Returns:

config – The configuration dictionary.

Return type:

dict

abstractmethod save(h5_file, path='flow')[source]#
classmethod load(h5_file, path='flow')[source]#
Abstractmethod: