class_docstr: Contains unit tests for the TransportNNDistanceComputer class. 
class_docstr_tok: ["Contains","unit","tests","for","the","TransportNNDistanceComputer","class","."]
docstr: Tests for adding data, evaluation and marginal likelihood. 
docstr_tok: ["Tests","for","adding","data",",","evaluation","and","marginal","likelihood","."]
code: def test_basics(self):
      """Tests for adding data, evaluation and marginal likelihood."""
      self.report(
          "Testing adding data, evaluation and marginal likelihood."
          + " Probabilistic test, might fail."
      )
      num_coeffs_vals = [2, 1, 4, 5] * 5
      num_tests = 0
      num_successes = 0
      for dataset in self.datasets:
          for dist_type in self.dist_types:
              for kernel_type in self.kernel_types[dist_type]:
                  curr_num_coeffs = num_coeffs_vals.pop(0)
                  curr_gp = build_nngp_with_dataset(
                      dataset, kernel_type, curr_num_coeffs, dist_type
                  )
                  # Predictions & Marginal likelihood
                  curr_preds, _ = curr_gp.eval(dataset[2], "std")
                  curr_gp_err = compute_average_prediction_error(
                      dataset, curr_preds
                  )
                  const_err = compute_average_prediction_error(
                      dataset, dataset[1].mean()
                  )
                  lml = curr_gp.compute_log_marginal_likelihood()
                  is_success = curr_gp_err < const_err
                  num_tests += 1
                  num_successes += is_success
                  self.report(
                      (
                          "(%s, ntr=%d, nte=%d):: GP-lml=%0.4f, GP-err=%0.4f, "
                          + "Const-err=%0.4f.  succ=%d"
                      )
                      % (
                          dataset[-1][:5],
                          len(dataset[0]),
                          len(dataset[2]),
                          lml,
                          curr_gp_err,
                          const_err,
                          is_success,
                      ),
                      "test_result",
                  )
      succ_frac = num_successes / float(num_tests)
      self.report(
          "Summary: num_successes / num_floats = %d/%d = %0.4f"
          % (num_successes, num_tests, succ_frac),
          "test_result",
      )
      assert succ_frac > 0.5
  
imports: import numpy
  import unittest
  from .syn_nn_functions import syn_func1_common, cnn_syn_func1, mlp_syn_func1
  from .nn_examples import generate_cnn_architectures, generate_mlp_architectures
  from .None import nn_gp
  from ..utils.ancillary_utils import get_list_of_floats_as_str
  from ..utils.base_test_class import BaseTestClass, execute_tests
  from ..utils.option_handler import load_options
label_desc: Use image node_id 2 for calling the NNGPTestCase obj's underlying member method code with example usage: obj.test_basics() without return types