TransportMaps.Algorithms.Adaptivity.KullbackLeiblerAdaptivity
¶
Module Contents¶
Classes¶
Solve over a list of maps, using the former to warm start the next one |
|
Solve over a list of maps, using the former to warm start the next one, until a target tolerance is met |
|
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
ofTransportMap
): transport maps \(T\)
- base_distribution (
Distribution
): distribution \(\nu_\rho\)
- target_distribution (
Distribution
): distribution \(\nu_\pi\)
- solve_params (
list
ofdict
): 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.
- transport_map (
- 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
ofTransportMap
): transport maps \(T\)
- base_distribution (
Distribution
): distribution \(\nu_\rho\)
- target_distribution (
Distribution
): distribution \(\nu_\pi\)
- solve_params (
list
ofdict
): 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.- transport_map (
- 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)\]- 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. Ifstate
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 _kl_divergence_fv_line_search(pi, w, tm_ev, fv_tri_tm_ev, tm_pxd, fv_tri_tm_pxd, line_search_params, mpi_pool, interactive=False)[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 insensitivities
.
- static _prune_map(tm, coeffs_weights, coeff_trunc, method='active')[source]¶
With the option
method==active
all theactive
vertices will be considered for removal. With the optionmethod==childless
only theactive
childless vertices of the semilattices will be considered for removal. In both cases the roots will never be removed/inactivated.