class_docstr: Unit tests for the MFGPFitter class. 
class_docstr_tok: ["Unit","tests","for","the","MFGPFitter","class","."]
docstr: Test for drawing samples. 
docstr_tok: ["Test","for","drawing","samples","."]
code: def test_draw_samples(self):
      """Test for drawing samples."""
      self.report(
          "Test for drawing samples. Probabilistic test, might fail."
      )
      total_coverage = 0
      num_test_pts = 100
      num_samples = (
          5  # Draw 5 samples at each point - just for testing.
      )
      mfgp_instances = gen_mf_gp_instances()
      for inst in mfgp_instances:
          Z_test = np.random.random((num_test_pts, inst.fidel_dim))
          X_test = np.random.random((num_test_pts, inst.domain_dim))
          F_test = inst.post_gp.draw_mf_samples(
              num_samples, Z_test, X_test
          )
          post_mean, post_std = inst.post_gp.eval_at_fidel(
              Z_test, X_test, uncert_form="std"
          )
          conf_band_width = 1.96
          ucb = post_mean + conf_band_width * post_std
          lcb = post_mean - conf_band_width * post_std
          below_ucb = F_test <= ucb
          above_lcb = F_test >= lcb
          coverage = (below_ucb * above_lcb).mean()
          total_coverage += coverage
          self.report(
              (
                  "(n, DZ, DX) = (%d, %d, %d)::: Coverage for 0.95 credible interval: "
                  + "%0.4f"
              )
              % (
                  inst.num_data,
                  inst.fidel_dim,
                  inst.domain_dim,
                  coverage,
              ),
              "test_result",
          )
      avg_coverage = total_coverage / len(mfgp_instances)
      avg_coverage_is_good = avg_coverage > 0.9
      self.report(
          "Avg coverage (%0.3f) is larger than 0.9? %d"
          % (avg_coverage, avg_coverage_is_good),
          "test_result",
      )
      assert avg_coverage_is_good
  
imports: from __future__ import division
  from argparse import Namespace
  from copy import deepcopy
  import numpy
  from .None import kernel
  from .unittest_euclidean_gp import fit_se_gp_with_dataset, fit_matern_gp_with_dataset, fit_poly_gp_with_dataset
  from .None import euclidean_gp
  from ..utils.base_test_class import BaseTestClass, execute_tests
  from ..utils.general_utils import compute_average_sq_prediction_error
  from ..utils.option_handler import load_options
label_desc: Use image node_id 4 for calling the EuclideanMFGPFitterTestCase obj's underlying member method code with example usage: obj.test_draw_samples() without return types