class_docstr: Nested sampler with reactive exploration strategy.
  
  Storage & resume capable, optionally MPI parallelised.
class_docstr_tok: ["Nested","sampler","with","reactive","exploration","strategy",".","Storage","&","resume","capable",",","optionally","MPI","parallelised","."]
docstr: Test the `transform` and `loglike`lihood functions.
  
  `num_test_samples` samples are used to check whether they work and give the correct output.
  
  returns whether the most recently stored point (if any)
  still returns the same likelihood value.
docstr_tok: ["Test","the","`","transform","`","and","`","loglike","`","lihood","functions",".","`","num_test_samples","`","samples","are","used","to","check","whether","they","work","and","give","the","correct","output",".","returns","whether","the","most","recently","stored","point","(","if","any",")","still","returns","the","same","likelihood","value","."]
code: def _check_likelihood_function(
      self, transform, loglike, num_test_samples
  ):
      """Test the `transform` and `loglike`lihood functions.
  
      `num_test_samples` samples are used to check whether they work and give the correct output.
  
      returns whether the most recently stored point (if any)
      still returns the same likelihood value.
      """
      # do some checks on the likelihood function
      # this makes debugging easier by failing early with meaningful errors
  
      # if we are resuming, check that last sample still gives same result
      num_resume_test_samples = 0
      if num_test_samples and not self.pointstore.stack_empty:
          num_resume_test_samples = 1
          num_test_samples -= 1
  
      if num_test_samples > 0:
          # test with num_test_samples random points
          u = np.random.uniform(size=(num_test_samples, self.x_dim))
          p = transform(u) if transform is not None else u
          assert np.shape(p) == (num_test_samples, self.num_params), (
              "Error in transform function: returned shape is %s, expected %s"
              % (np.shape(p), (num_test_samples, self.num_params))
          )
          logl = loglike(p)
          assert np.logical_and(
              u > 0, u < 1
          ).all(), "Error in transform function: u was modified!"
          assert np.shape(logl) == (num_test_samples,), (
              "Error in loglikelihood function: returned shape is %s, expected %s"
              % (np.shape(logl), (num_test_samples,))
          )
          assert np.isfinite(logl).all(), (
              "Error in loglikelihood function: returned non-finite number: %s for input u=%s p=%s"
              % (logl, u, p)
          )
  
      if (
          not self.pointstore.stack_empty
          and num_resume_test_samples > 0
      ):
          # test that last sample gives the same likelihood value
          _, lastrow = self.pointstore.stack[-1]
          assert len(lastrow) == 3 + self.x_dim + self.num_params, (
              "Cannot resume: problem has different dimensionality",
              len(lastrow),
              (2, self.x_dim, self.num_params),
          )
          lastL = lastrow[1]
          lastu = lastrow[3 : 3 + self.x_dim]
          u = lastu.reshape((1, -1))
          lastp = lastrow[
              3 + self.x_dim : 3 + self.x_dim + self.num_params
          ]
          if self.log:
              self.logger.debug(
                  "Testing resume consistency: %s: u=%s -> p=%s -> L=%s ",
                  lastrow,
                  lastu,
                  lastp,
                  lastL,
              )
          p = transform(u) if transform is not None else u
          if not np.allclose(p.flatten(), lastp) and self.log:
              self.logger.warning(
                  "Trying to resume from previous run, but transform function gives different result: %s gave %s, now %s",
                  lastu,
                  lastp,
                  p.flatten(),
              )
          assert np.allclose(p.flatten(), lastp), (
              "Cannot resume because transform function changed. "
              "To start from scratch, delete '%s'."
              % (self.logs["run_dir"])
          )
          logl = loglike(p).flatten()[0]
          if not np.isclose(logl, lastL) and self.log:
              self.logger.warning(
                  "Trying to resume from previous run, but likelihood function gives different result: %s gave %s, now %s",
                  lastu.flatten(),
                  lastL,
                  logl,
              )
          return np.isclose(logl, lastL)
      return True
  
imports: from __future__ import print_function, division
  import os
  import sys
  import csv
  import json
  import operator
  import time
  import warnings
  from numpy import log, exp, logaddexp
  import numpy
  from .utils import create_logger, make_run_dir, resample_equal, vol_prefactor, vectorize, listify
  from .utils import is_affine_transform, normalised_kendall_tau_distance, distributed_work_chunk_size
  from ultranest.mlfriends import MLFriends, AffineLayer, ScalingLayer, find_nearby, WrappingEllipsoid, RobustEllipsoidRegion
  from .store import HDF5PointStore, TextPointStore, NullPointStore
  from .viz import get_default_viz_callback
  from .ordertest import UniformOrderAccumulator
  from .netiter import PointPile, SingleCounter, MultiCounter, BreadthFirstIterator, TreeNode, count_tree_between, find_nodes_before, logz_sequence
  from .netiter import dump_tree, combine_results
  from .hotstart import get_auxiliary_contbox_parameterization
label_desc: Use image node_id 3 for calling the ReactiveNestedSampler obj's underlying member method code with example usage: obj._check_likelihood_function(transform, loglike, num_test_samples) and returns: True, np