TransportMaps.Algorithms.Adaptivity.KullbackLeiblerAdaptivity

Module Contents

Classes

SequentialKullbackLeiblerBuilder

Solve over a list of maps, using the former to warm start the next one

ToleranceSequentialKullbackLeiblerBuilder

Solve over a list of maps, using the former to warm start the next one, until a target tolerance is met

FirstVariationKullbackLeiblerBuilder

Adaptive builder based on the first variation of the kl divergence

class TransportMaps.Algorithms.Adaptivity.KullbackLeiblerAdaptivity.SequentialKullbackLeiblerBuilder(validator=None, regression_params_list=None, callback=None, callback_kwargs={}, verbosity=0)[source]

Bases: TransportMaps.Builders.KullbackLeiblerBuilder

Solve over a list of maps, using the former to warm start the next one

Given distribution \(\nu_\rho\) and \(\nu_\pi\), and the list of parametric transport maps \([T_1[{\bf a}_1,\ldots,T_n[{\bf a}_n]\), provides the functionalities to solve the problems

\[\arg\min_{{\bf a}_i}\mathcal{D}_{\rm KL}\left( T_i[{\bf a}_i]_\sharp\rho \Vert \pi\right)\]

up to a chosen tolerance, where the numerical solution for map \(T_{i+1}\) is started at \(T_i\)

solve(transport_map: List[TransportMaps.Maps.ParametricTransportMap] = None, base_distribution: TransportMaps.Distributions.Distribution = None, target_distribution: TransportMaps.Distributions.Distribution = None, solve_params: List[dict] = None, state=None, mpi_pool=None)[source]
Args
transport_map (list of TransportMap):

transport maps \(T\)

base_distribution (Distribution):

distribution \(\nu_\rho\)

target_distribution (Distribution):

distribution \(\nu_\pi\)

solve_params (list of dict):

list of dictionaries of parameters for solution

state (TransportMaps.DataStorageObject):

if provided, it must contain all the information needed for reloading, or a handle to an empty storage object which can be externally stored. If state contains the keys corresponding to arguments to this function, they will be used instead of the input themselves.

Returns:

(TransportMaps.Maps.TransportMap) – the transport map fitted.

class TransportMaps.Algorithms.Adaptivity.KullbackLeiblerAdaptivity.ToleranceSequentialKullbackLeiblerBuilder(validator=None, tol=0.01, laplace_pull=False, callback=None, callback_kwargs={}, verbosity=0)[source]

Bases: TransportMaps.Builders.KullbackLeiblerBuilder

Solve over a list of maps, using the former to warm start the next one, until a target tolerance is met

Given distribution \(\nu_\rho\) and \(\nu_\pi\), and the list of parametric transport maps \([T_1[{\bf a}_1,\ldots,T_n[{\bf a}_n]\), provides the functionalities to solve the problems

\[\arg\min_{{\bf a}_i}\mathcal{D}_{\rm KL}\left( T_i[{\bf a}_i]_\sharp\rho \Vert \pi\right)\]

up to a chosen tolerance, where the numerical solution for map \(T_{i+1}\) is started at \(T_i\)

solve(transport_map: List[TransportMaps.Maps.ParametricTransportMap], base_distribution: TransportMaps.Distributions.Distribution, target_distribution: TransportMaps.Distributions.Distribution, solve_params: List[dict], var_diag_params: dict, state=None, mpi_pool=None)[source]
Args
transport_map (list of TransportMap):

transport maps \(T\)

base_distribution (Distribution):

distribution \(\nu_\rho\)

target_distribution (Distribution):

distribution \(\nu_\pi\)

solve_params (list of dict):

list of dictionaries of parameters for solution

var_diag_params (dict): parameters to be used in the variance diagnostic approximation state (TransportMaps.DataStorageObject):

if provided, it must contain all the information needed for reloading, or a handle to an empty storage object which can be externally stored. If state contains the keys corresponding to arguments to this function, they will be used instead of the input themselves.

Returns:

(TransportMaps.Maps.TransportMap) – the transport map fitted.

class TransportMaps.Algorithms.Adaptivity.KullbackLeiblerAdaptivity.FirstVariationKullbackLeiblerBuilder(validator, eps_bull, regression_builder=L2RegressionBuilder(), line_search_params={}, max_it=20, prune_trunc={'type': 'manual', 'val': None}, avar_trunc={'type': 'manual', 'val': None}, coeff_trunc={'type': 'manual', 'val': None}, callback=None, callback_kwargs={}, verbosity=0, interactive=False)[source]

Bases: TransportMaps.Builders.KullbackLeiblerBuilder

Adaptive builder based on the first variation of the kl divergence

Given distribution \(\nu_\rho\) and \(\nu_\pi\), and the parametric transport map \(T[{\bf a}]\), provides the functionalities to solve the problem

\[\arg\min_{\bf a}\mathcal{D}_{\rm KL}\left( T[{\bf a}]_\sharp\rho \Vert \pi\right) = \arg\min_{\bf a}\underbrace{\mathbb{E}_\rho\left[ -\log T[{\bf a}]^\sharp\pi \right]}_{ \mathcal{J}[T]({\bf x})}\]

up to a chosen tolerance, by enriching the map using information from the first variation

\[\nabla\mathcal{J}[T]({\bf x}) = (\nabla_{\bf x}T)^{-\top} \left(\log\frac{\rho({\bf x})}{T^\sharp\pi({\bf x})}\right)\]
_validation(state, mpi_pool=None)[source]
_diagnostic(state, mpi_pool=None)[source]
_refinement(state, cache=None, mpi_pool=None)[source]
solve(transport_map=None, base_distribution=None, target_distribution=None, solve_params=None, state=None, mpi_pool=None)[source]
Parameters:
  • transport_map (TransportMap) – starting transport map \(T\)

  • base_distribution (Distribution) – distribution \(\nu_\rho\)

  • target_distribution (Distribution) – distribution \(\nu_\pi\)

  • solve_params (dict) – dictionary of parameters for solutino

  • state (TransportMaps.DataStorageObject) – if provided, it must contain all the information needed for reloading, or a handle to an empty storage object which can be externally stored. If state contains the keys corresponding to arguments to this function, they will be used instead of the input themselves.

Returns:

(TransportMaps.Maps.TransportMap) – the transport map fitted.

static _compute_first_variation(x, w, d1, d2, cache=None, batch_size=None, mpi_pool=None)[source]
static _first_variation_candidate_triangular_map(transport_map, sensitivities, avar_trunc)[source]

Construct the candidate map to be used in the regression of the first variation.

It takes the multi-indices in transport_map and increases them by one, adding also active variables if needed. The active variables to add are detected using the information contained in sensitivities.

static _improved_candidate_map(transport_map, fv_map)[source]
static _prune_map(tm, coeffs_weights, coeff_trunc, method='active')[source]

With the option method==active all the active vertices will be considered for removal. With the option method==childless only the active childless vertices of the semilattices will be considered for removal. In both cases the roots will never be removed/inactivated.

Parameters:
  • coeffs_weights (list) – weights for each degree of freedom. Must be len(coeffs_weights)==tm.n_coeffs. Degrees of freedoms with lower coefficients will be removed.

  • method (str) – method for pruning. Available options are childless, active.