class_docstr: This class is essentially an API for the AUC object.
  This class contains methods for inspecting the AUC for different criteria.
  To input the different criteria, use the static variable ``criteria``.
docstr: Retrieve the index in this metric's threshold list at which the given threshold is located.
  
  :param threshold: Find the index of this input threshold.
  :returns: the index.
  :raises ValueError: if no such index can be found.
  
  :examples:
  
  >>> from h2o.estimators.gbm import H2OGradientBoostingEstimator
  >>> local_data = [[1, 'a'],[1, 'a'],[1, 'a'],[1, 'a'],[1, 'a'],
  ...               [1, 'a'],[1, 'a'],[1, 'a'],[1, 'a'],[1, 'a'],
  ...               [0, 'b'],[0, 'b'],[0, 'b'],[0, 'b'],[0, 'b'],
  ...               [0, 'b'],[0, 'b'],[0, 'b'],[0, 'b'],[0, 'b']]
  >>> h2o_data = h2o.H2OFrame(local_data)
  >>> h2o_data.set_names(['response', 'predictor'])
  >>> h2o_data["response"] = h2o_data["response"].asfactor()
  >>> gbm = H2OGradientBoostingEstimator(ntrees=1,
  ...                                    distribution="bernoulli")
  >>> gbm.train(x=list(range(1,h2o_data.ncol)),
  ...           y="response",
  ...           training_frame=h2o_data)
  >>> perf = gbm.model_performance()
  >>> perf.find_idx_by_threshold(0.45)
docstr_tok: ["Retrieve","the","index","in","this","metric","'s","threshold","list","at","which","the","given","threshold","is","located",".",":","param","threshold",":","Find","the","index","of","this","input","threshold",".",":","returns",":","the","index",".",":","raises","ValueError",":","if","no","such","index","can","be","found",".",":","examples",":",">",">",">","from","h2o.estimators.gbm","import","H2OGradientBoostingEstimator",">",">",">","local_data","=","[","[","1",",","'","a","'","]",",","[","1",",","'","a","'","]",",","[","1",",","'","a","'","]",",","[","1",",","'","a","'","]",",","[","1",",","'","a","'","]",",","...","[","1",",","'","a","'","]",",","[","1",",","'","a","'","]",",","[","1",",","'","a","'","]",",","[","1",",","'","a","'","]",",","[","1",",","'","a","'","]",",","...","[","0",",","'","b","'","]",",","[","0",",","'","b","'","]",",","[","0",",","'","b","'","]",",","[","0",",","'","b","'","]",",","[","0",",","'","b","'","]",",","...","[","0",",","'","b","'","]",",","[","0",",","'","b","'","]",",","[","0",",","'","b","'","]",",","[","0",",","'","b","'","]",",","[","0",",","'","b","'","]","]",">",">",">","h2o_data","=","h2o.H2OFrame","(","local_data",")",">",">",">","h2o_data.set_names","(","[","'response","'",",","'predictor","'","]",")",">",">",">","h2o_data","[","``","response","''","]","=","h2o_data","[","``","response","''","]",".asfactor","(",")",">",">",">","gbm","=","H2OGradientBoostingEstimator","(","ntrees=1",",","...","distribution=","''","bernoulli","''",")",">",">",">","gbm.train","(","x=list","(","range","(","1",",","h2o_data.ncol",")",")",",","...","y=","''","response","''",",","...","training_frame=h2o_data",")",">",">",">","perf","=","gbm.model_performance","(",")",">",">",">","perf.find_idx_by_threshold","(","0.45",")"]
code: def find_idx_by_threshold(self, threshold):
      """
      Retrieve the index in this metric's threshold list at which the given threshold is located.
  
      :param threshold: Find the index of this input threshold.
      :returns: the index.
      :raises ValueError: if no such index can be found.
  
      :examples:
  
      >>> from h2o.estimators.gbm import H2OGradientBoostingEstimator
      >>> local_data = [[1, 'a'],[1, 'a'],[1, 'a'],[1, 'a'],[1, 'a'],
      ...               [1, 'a'],[1, 'a'],[1, 'a'],[1, 'a'],[1, 'a'],
      ...               [0, 'b'],[0, 'b'],[0, 'b'],[0, 'b'],[0, 'b'],
      ...               [0, 'b'],[0, 'b'],[0, 'b'],[0, 'b'],[0, 'b']]
      >>> h2o_data = h2o.H2OFrame(local_data)
      >>> h2o_data.set_names(['response', 'predictor'])
      >>> h2o_data["response"] = h2o_data["response"].asfactor()
      >>> gbm = H2OGradientBoostingEstimator(ntrees=1,
      ...                                    distribution="bernoulli")
      >>> gbm.train(x=list(range(1,h2o_data.ncol)),
      ...           y="response",
      ...           training_frame=h2o_data)
      >>> perf = gbm.model_performance()
      >>> perf.find_idx_by_threshold(0.45)
      """
      assert_is_type(threshold, numeric)
      thresh2d = self._metric_json["thresholds_and_metric_scores"]
      # print(thresh2d)
      for i, e in enumerate(thresh2d.cell_values):
          t = float(e[0])
          if abs(t - threshold) < 1e-8 * max(t, threshold):
              return i
      if 0 <= threshold <= 1:
          thresholds = [
              float(e[0]) for i, e in enumerate(thresh2d.cell_values)
          ]
          threshold_diffs = [abs(t - threshold) for t in thresholds]
          closest_idx = threshold_diffs.index(min(threshold_diffs))
          closest_threshold = thresholds[closest_idx]
          print(
              "Could not find exact threshold {0}; using closest threshold found {1}.".format(
                  threshold, closest_threshold
              )
          )
          return closest_idx
      raise ValueError(
          "Threshold must be between 0 and 1, but got {0} ".format(
              threshold
          )
      )
  
imports: import h2o
  from h2o.model import MetricsBase, ConfusionMatrix
  from h2o.plot import get_matplotlib_pyplot, decorate_plot_result, RAISE_ON_FIGURE_ACCESS
  from h2o.utils.metaclass import deprecated_params
  from h2o.utils.shared_utils import List
  from h2o.utils.typechecks import assert_is_type, numeric, is_type, assert_satisfies
label_desc: Use image node_id 31 for calling the H2OBinomialModelMetrics obj's underlying member method code with example usage: obj.find_idx_by_threshold(threshold) and returns: closest_idx, i