code: def estimated_ape(ns, num_vi_steps):
      designs = [
          group_assignment_matrix(torch.tensor([n1, N - n1]))
          for n1 in ns
      ]
      X = torch.stack(designs)
      est_ape = vi_eig(
          model,
          X,
          observation_labels="y",
          target_labels="w",
          vi_parameters={
              "guide": guide,
              "optim": optim.Adam({"lr": 0.05}),
              "loss": TraceEnum_ELBO(
                  strict_enumeration_warning=False
              ).differentiable_loss,
              "num_steps": num_vi_steps,
          },
          is_parameters={"num_samples": 1},
          eig=False,
      )
      return est_ape
  
file_path: pyro/examples/contrib/oed/ab_test.py
imports: import argparse
  from functools import partial
  import numpy
  import torch
  from gp_bayes_opt import GPBayesOptimizer
  from torch.distributions import constraints
  import pyro
  import pyro.contrib.gp
  from pyro import optim
  from pyro.contrib.oed.eig import vi_eig
  from pyro.contrib.oed.glmm import analytic_posterior_cov, group_assignment_matrix, zero_mean_unit_obs_sd_lm
  from pyro.infer import TraceEnum_ELBO
label_desc: Use image node_id 1 for calling a global function with example usage: estimated_ape(ns, num_vi_steps) and returns: est_ape