TransportMaps.Diagnostics.Validators
¶
Module Contents¶
Classes¶
Base object for every object in the module. |
|
Base object for every object in the module. |
|
Bootstrap the gradient to check whether cost function is flat independently of the sample. |
|
Base object for every object in the module. |
- class TransportMaps.Diagnostics.Validators.KLMinimizationValidator(eps, cost_function=no_cost_function, max_cost=np.inf, max_nsamps=np.inf, stop_on_fcast=False)[source]¶
Bases:
TransportMaps.ObjectBase.TMO
Base object for every object in the module.
This object provides functions for storage and parallelization.
- pre_solve(base_distribution, target_distribution, transport_map, validation_params)[source]¶
Implements a routine to be initialize variables before the solving stage.
This function should initialize quantities that are needed for a particular validator.
- post_solve(base_distribution, target_distribution, transport_map, validation_params)[source]¶
Implements a routine to be make sure the variables set in presolve are in the correct state post exiting the solving stage.
Since, in principle, algorithms can be stopped and re-started, this allows variables to be cleaned up when not needed.
- solve_to_tolerance(transport_map, base_distribution, target_distribution, solve_params, mpi_pool=None)[source]¶
- abstract stopping_criterion(*args, **kwargs)[source]¶
Implements the stopping criterion for the particular validator
This function should return a target error value (e.g. the target error taking into account the magnitude of the objective and the absolute/relative tolerances).
In theory :fun:`error_estimation<KLMinimizationValidator.error_estimation>` could handle everything by itself. This abstract method aims to provide more structure to the code.
See the implementation :fun:`SampleAverageApproximationKLMinimizationValidator.stopping_criterion` for an example.
- class TransportMaps.Diagnostics.Validators.SampleAverageApproximationKLMinimizationValidator(eps, eps_abs=1e-13, cost_function=no_cost_function, max_cost=np.inf, max_nsamps=np.inf, stop_on_fcast=False, upper_mult=10, lower_n=2, alpha=0.05, lmb_def=2, lmb_max=10)[source]¶
Bases:
KLMinimizationValidator
Base object for every object in the module.
This object provides functions for storage and parallelization.
- stopping_criterion(err_mag=None)[source]¶
Implements the stopping criterion for the particular validator
This function should return a target error value (e.g. the target error taking into account the magnitude of the objective and the absolute/relative tolerances).
In theory :fun:`error_estimation<KLMinimizationValidator.error_estimation>` could handle everything by itself. This abstract method aims to provide more structure to the code.
See the implementation :fun:`SampleAverageApproximationKLMinimizationValidator.stopping_criterion` for an example.
- class TransportMaps.Diagnostics.Validators.GradientBootstrapKLMinimizationValidator(eps, delta=5, cost_function=no_cost_function, max_cost=np.inf, max_nsamps=np.inf, stop_on_fcast=False, n_grad_samps=1, n_bootstrap=2000, alpha=0.95, lmb_min=2, lmb_max=10)[source]¶
Bases:
KLMinimizationValidator
Bootstrap the gradient to check whether cost function is flat independently of the sample.
For the current solution \({\bf a}\), minimizing the cost \(\mathcal{Q}_n[\mathcal{J}[{\bf a}]({\bf x})]\), for the sample \({\bf x}^\star\), check that
\[\mathbb{P}\left[ \left\Vert\mathcal{Q}_n[\nabla_{\bf a}\mathcal{J}[{\bf a}]({\bf x})]\right\Vert_2 \leq \delta \left\Vert\mathcal{Q}_n[\nabla_{\bf a}\mathcal{J}[{\bf a}]({\bf x}^\star)]\right\Vert_2 + \varepsilon \right] \geq \alpha\]- Parameters:
delta (float) – multiplicative factor \(\delta\)
- pre_solve(base_distribution, target_distribution, transport_map, validation_params)[source]¶
Implements a routine to be initialize variables before the solving stage.
This function should initialize quantities that are needed for a particular validator.
- stopping_criterion(obj=None, grad=None, validation_params=None)[source]¶
Implements the stopping criterion for the particular validator
This function should return a target error value (e.g. the target error taking into account the magnitude of the objective and the absolute/relative tolerances).
In theory :fun:`error_estimation<KLMinimizationValidator.error_estimation>` could handle everything by itself. This abstract method aims to provide more structure to the code.
See the implementation :fun:`SampleAverageApproximationKLMinimizationValidator.stopping_criterion` for an example.
- class TransportMaps.Diagnostics.Validators.DimensionAdaptiveSparseGridKLMinimizationValidator(*args, **kwargs)[source]¶
Bases:
KLMinimizationValidator
Base object for every object in the module.
This object provides functions for storage and parallelization.
- pre_solve(base_distribution, target_distribution, transport_map, validation_params)[source]¶
Implements a routine to be initialize variables before the solving stage.
This function should initialize quantities that are needed for a particular validator.
- post_solve(base_distribution, target_distribution, transport_map, validation_params)[source]¶
Implements a routine to be make sure the variables set in presolve are in the correct state post exiting the solving stage.
Since, in principle, algorithms can be stopped and re-started, this allows variables to be cleaned up when not needed.
- stopping_criterion(solve_params)[source]¶
Implements the stopping criterion for the particular validator
This function should return a target error value (e.g. the target error taking into account the magnitude of the objective and the absolute/relative tolerances).
In theory :fun:`error_estimation<KLMinimizationValidator.error_estimation>` could handle everything by itself. This abstract method aims to provide more structure to the code.
See the implementation :fun:`SampleAverageApproximationKLMinimizationValidator.stopping_criterion` for an example.