class_docstr: Class for fitting Gaussian processes. 
class_docstr_tok: ["Class","for","fitting","Gaussian","processes","."]
docstr: Fits a GP according to the tuning criterions. 
docstr_tok: ["Fits","a","GP","according","to","the","tuning","criterions","."]
code: def fit_gp_for_gp_bandit(self, num_samples=1):
      """Fits a GP according to the tuning criterions."""
      self.hp_tune_results = {}
      for method in self.methods_to_use:
          ret = self.fit_gp(num_samples, method)
          if ret[0] == "fitted_gp":
              self.hp_tune_results[method] = (ret[0], ret[1])
          elif ret[0] == "post_fitted_gp":
              self.hp_tune_results[method] = (ret[0], ret[1])
          elif ret[0] == "sample_hps_with_probs":
              # in this case, ret is a 5-tuple where ret[0] is sample_hps_with_probs, ret[1] is
              # a list of continuous hps, ret[2] is a list of discrete hps, ret[3] is either
              # None or a namespace containing the field add_gp_groupings.
              # See gp.gp_core.fit_gp
              sample_hps = list(zip(ret[1], ret[2], ret[3]))
              sample_probs = ret[-1]
              # Sample the hyper_parameters we will use until the next time we build a model.
              if sum(sample_probs > 0) >= num_samples:
                  to_replace = self.options.rand_exp_sampling_replace
              else:
                  to_replace = True
              use_hps_idxs = np.random.choice(
                  len(sample_hps),
                  size=(num_samples,),
                  replace=to_replace,
                  p=sample_probs,
              )
              self.hp_tune_results[method] = (
                  ret[0],
                  [sample_hps[idx] for idx in use_hps_idxs],
              )
          elif ret[0] == "post_sample_hps_with_probs":
              # in this case, ret is a 4-tuple where ret[0] is post_sample_hps_with_probs,
              # ret[1] is a list of continuous hps, ret[2] is a list of discrete hps, ret[3]
              # is either None or a namespace containing the field add_gp_groupings.
              # See gp.gp_core.fit_gp
              self.hp_tune_results[method] = (
                  ret[0],
                  list(zip(ret[1], ret[2], ret[3])),
              )
          else:
              raise ValueError(
                  "Unknown option %s for results of fit_gp." % (ret[0])
              )
  
imports: from __future__ import division
  from argparse import Namespace
  from itertools import product
  import sys
  import numpy
  from ..distributions.model import Model
  from ..distributions import continuous
  from ..distributions import discrete
  from ..utils.general_utils import stable_cholesky, draw_gaussian_samples, project_symmetric_to_psd_cone, solve_lower_triangular, solve_upper_triangular
  from ..utils.oper_utils import direct_ft_maximise, pdoo_maximise, random_maximise, random_sample_cts_dscr
  from ..utils.option_handler import get_option_specs, load_options
  from ..utils.reporters import get_reporter
label_desc: Use image node_id 19 for calling the GPFitter obj's underlying member method code with example usage: obj.fit_gp_for_gp_bandit(num_samples) without return types