Note
Go to the end to download the full example code
Approximate Control Variate Allocation Matrices
Optimizing and constructing PACV estimators requires estimating
For example, when computing the mean of a scalar model when the covariance between models is given by
and
where
The implementation of PACV uses allocation matrices
For example, the allocation matrix of ACVMF using
An entry of one indicates in the ith row of the jth column indicates that the ith independent sample set is used in the corresponding set
Note, here we focus on how to construct and use allocation matrices for ACVMF like PACV estimtors. However, much of the discussion carries over to other estimators like those based on recursive difference and ACVIS.
The allocation matrix together with the number of points
Defining
each entry of B can be computed using
where
Note computing
Finally, to compute the computational cost of the estimator we must be able to compute the number of samples per model. The number of samples of the ith
where
Using our example, the intersection matrix is
So summing each column of S we have
And
The first row and column are all zero because
As an example the thrid entry from the right on the bottom row corresponds to
Examples of different allocation matrices
The following lists some example alloaction matrices for the parameterically defined ACV estimators based on the general structure of ACVMF.
MFMC
How to construct ACVMF like allocation matrices
The following shows the general procedure to construct ACVMF like estimators for a recursion index
As a concrete example, consider the recursion index
First we set
E.g. for (0,0,1)
We then set
And finally because ACMF always uses all independent partitions up to including
The following can be used to plot the allocation matrix of any PACV estimator (not just GMF). Note we load a benchmark because it is needed to initialize the PACV estimator, but the allocation matrix is independent of any benchmark properties other than the number of models it provides
import matplotlib.pyplot as plt
from pyapprox.benchmarks import setup_benchmark
from pyapprox.multifidelity.factory import get_estimator, multioutput_stats
benchmark = setup_benchmark("tunable_model_ensemble")
model = benchmark.fun
stat = multioutput_stats["mean"](benchmark.nqoi)
stat.set_pilot_quantities(benchmark.covariance)
est = get_estimator("grd", stat, model.costs(), recursion_index=(2, 0))
ax = plt.subplots(1, 1, figsize=(8, 6))[1]
_ = est.plot_allocation(ax)

The different colors represent different independent sample partitions. Subsets
Try changing recursion index to (0, 1) or (2, 0) and the estimator from “gis” to “gmf” or” grd”
Evaluating a PACV estimator
Allocation matrices are also useful for evaluating a PACV estimator.
To evaluate the ACV estimator we must construct each independent sample partition from a set of
We then must allocate each model on a subset of these samples dictated by the allocation matrix. For a model index
The user can then evaluate each model without knowing anything about the ACV estimator sets or the independent partitions.
These model evaluations are then passed back to the estimator and internally we must assigne the values to each ACV estimator sample set. Specifically for each model
Total running time of the script: ( 0 minutes 0.037 seconds)