code: def mcmc_sampling(self, filtered_funcs, func_params, timeout):
      t0 = time.time()
      init_weight = np.ones(
          (len(filtered_funcs),), dtype=np.float32
      ) / len(filtered_funcs)
      weights_samples = np.broadcast_to(
          init_weight, (CurveModel.NUM_INSTANCE, len(filtered_funcs))
      )
      while True:
          new_values = (
              np.random.randn(
                  CurveModel.NUM_INSTANCE, len(filtered_funcs)
              )
              * CurveModel.STEP_SIZE
              + weights_samples
          )
          new_values = self.normalize_weights(
              new_values, len(filtered_funcs)
          )
          alpha = np.minimum(
              1,
              self.target_distribution(
                  new_values, filtered_funcs, func_params
              )
              / self.target_distribution(
                  weights_samples, filtered_funcs, func_params
              ),
          )
          u = np.random.rand(CurveModel.NUM_INSTANCE)
          change_value_flag = (u < alpha).astype(np.int)
          for idx in range(CurveModel.NUM_INSTANCE):
              new_values[idx] = (
                  weights_samples[idx] * (1 - change_value_flag[idx])
                  + new_values[idx] * change_value_flag[idx]
              )
          weights_samples = new_values
          if time.time() - t0 > timeout:
              break
      return weights_samples
  
imports: import scipy
  import logging
  import numpy
  import time
  from scipy import optimize
label_desc: Use image node_id 11 for calling the CurveModel obj's underlying member method code with example usage: obj.mcmc_sampling(filtered_funcs, func_params, timeout) and returns: weights_samples