Skip to content

Commit bff552d

Browse files
committed
Fix bug in how optimized variance is stored in MLBLUE
1 parent 692b568 commit bff552d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

pyapprox/multifidelity/monte_carlo_estimators.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1255,7 +1255,13 @@ def allocate_samples(self, target_cost, asketch,
12551255

12561256
# set attributes needed for self._estimate
12571257
self.nsamples_per_subset = nsamples_per_subset
1258-
self.optimized_variance = variance
1258+
# variance for unrounded nsamples_per_subset
1259+
# self.optimized_variance = variance/target_cost
1260+
# variance for rounded nsamples_per_subset
1261+
self.optimized_variance = BLUE_variance(
1262+
asketch, self.cov, None, self._reg_blue,
1263+
self.nsamples_per_subset)
1264+
print(self.optimized_variance, variance/target_cost)
12591265
self.rounded_target_cost = rounded_target_cost
12601266
self.subsets = subsets
12611267
return nsamples_per_subset, variance, rounded_target_cost

tutorials/multi_fidelity/plot_many_model_approximate_control_variate_monte_carlo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@
334334
#%%
335335
#The variance of the best ACV-GMFB still converges to the lowest possible variance. But its variance at small sample sizes is better than ACV-MF and comparable to MLMC.
336336
#
337-
#TODO Make note about how this scheme is useful when one model may have multiple discretizations.!!!!
338337

339338
#%%
340339
#Optimal Sample Allocation

0 commit comments

Comments
 (0)