class_docstr: Some common functionality for all MF Euclidean Fitter tests. 
class_docstr_tok: ["Some","common","functionality","for","all","MF","Euclidean","Fitter","tests","."]
docstr: Test for marginal likelihood. 
docstr_tok: ["Test","for","marginal","likelihood","."]
code: def _test_marginal_likelihood(
      self,
      get_gp_func1,
      get_gp_func2,
      descr1,
      descr2,
      compare_fits=True,
  ):
      """Test for marginal likelihood."""
      num_lml_successes = 0
      num_err_successes = 0
      num_experiments = 0
      for ds_idx, ds in enumerate(self.datasets):
          for kernel_type in ["se", "matern"]:
              gp1 = get_gp_func1(ds, kernel_type)
              gp2 = get_gp_func2(ds, kernel_type)
              lml1 = gp1.compute_log_marginal_likelihood()
              lml2 = gp2.compute_log_marginal_likelihood()
              preds1, _ = gp1.eval(ds.ZX_te)
              preds2, _ = gp2.eval(ds.ZX_te)
              err1 = compute_average_sq_prediction_error(
                  ds.Y_te, preds1
              )
              err2 = compute_average_sq_prediction_error(
                  ds.Y_te, preds2
              )
              lml_success = lml1 <= lml2
              err_success = err1 >= err2
              self.report(
                  "%d. (N,DZ,DX)= %s, kern=%s %s-lml=%0.4f, %s-lml=%0.4f, succ=%d"
                  % (
                      ds_idx + 1,
                      str(ds.Z_tr.shape + (ds.X_tr.shape[1],)),
                      kernel_type,
                      descr1,
                      lml1,
                      descr2,
                      lml2,
                      lml_success,
                  ),
                  "test_result",
              )
              self.report(
                  "  %s-err = %0.4f, %s-err = %0.4f, err_succ=%d."
                  % (descr1, err1, descr2, err2, err_success),
                  "test_result",
              )
              self.report(
                  "  %s GP :: %s" % (descr1, str(gp1)), "test_result"
              )
              self.report(
                  "  %s GP:: %s" % (descr2, str(gp2)), "test_result"
              )
              num_lml_successes += lml_success
              num_err_successes += err_success
              num_experiments += 1
      if compare_fits:
          assert num_lml_successes > 0.6 * num_experiments
          assert num_err_successes > 0.6 * num_experiments
  
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 2 for calling the EuclideanMFGPFitterBaseTestClass obj's underlying member method code with example usage: obj._test_marginal_likelihood(get_gp_func1, get_gp_func2, descr1, descr2, compare_fits) without return types