standardize_sample_ratios

pyapprox.control_variate_monte_carlo.standardize_sample_ratios(nhf_samples, nsample_ratios)[source]

Ensure num high fidelity samples is positive (>0) and then recompute sample ratios. This is useful when num high fidelity samples and sample ratios are computed by an optimization process. This function is useful for optimization problems with a numerical or analytical solution.

Parameters
nhf_samplesinteger

The number of samples of the high fidelity model

nsample_ratiosnp.ndarray (nmodels-1)

The sample ratios r used to specify the number of samples of the lower fidelity models, e.g. N_i = r_i*nhf_samples, i=1,…,nmodels-1

Returns
nhf_samplesinteger

The corrected number of samples of the high fidelity model

nsample_ratiosnp.ndarray (nmodels-1)

The corrected sample ratios