romtools.workflows.uq.sample_allocation#

Pilot-based sample allocation for two-level MFMC.

Functions

allocate_samples_from_pilot(...[, ...])

Select integer high- and low-fidelity counts from paired pilot data.

Classes

PilotSampleAllocation(...)

Integer sample allocation selected from paired pilot data.

class romtools.workflows.uq.sample_allocation.PilotSampleAllocation(number_high_fidelity_samples, number_low_fidelity_samples, control_variate_coefficients, pilot_correlations, estimated_variance, high_fidelity_equivalent_cost, use_multifidelity_estimator)[source]#

Bases: object

Integer sample allocation selected from paired pilot data.

Parameters:
  • number_high_fidelity_samples (int)

  • number_low_fidelity_samples (int)

  • control_variate_coefficients (ndarray)

  • pilot_correlations (ndarray)

  • estimated_variance (float)

  • high_fidelity_equivalent_cost (float)

  • use_multifidelity_estimator (bool)

romtools.workflows.uq.sample_allocation.allocate_samples_from_pilot(high_fidelity_qois, low_fidelity_qois, high_fidelity_equivalent_budget, low_to_high_fidelity_cost_ratio, allocation_qoi_index=0)[source]#

Select integer high- and low-fidelity counts from paired pilot data.

The search minimizes the standard two-level MFMC variance approximation for the component selected by allocation_qoi_index subject to N_H + cost_ratio * N_L <= budget and N_L >= N_H. Pilot evaluations are included in the returned counts and cost. The result switches to an HF-only estimator when spending the remaining budget on high-fidelity samples has no larger predicted variance.

Parameters:
  • high_fidelity_qois (ndarray) – Paired pilot QoIs with shape (N_p, N_qoi) or (N_p,).

  • low_fidelity_qois (ndarray) – Low-fidelity pilot QoIs with the same shape and ordering as high_fidelity_qois.

  • high_fidelity_equivalent_budget (float) – Total budget in high-fidelity cost units.

  • low_to_high_fidelity_cost_ratio (float) – Positive cost ratio c_L / c_H.

  • allocation_qoi_index (int) – QoI component used by the allocation objective.

Returns:

Selected counts, frozen componentwise coefficients, pilot correlations, predicted variance and cost, and an indicator selecting MFMC or the HF-only fallback.

Return type:

PilotSampleAllocation

Raises:

ValueError – If the pilot arrays are incompatible, contain fewer than two samples, the selected component is invalid, or the pilot does not fit in the budget.