docstr: Get the metric value for a set of thresholds.
  
  If all are ``False`` (default), then return the training metric value.
  If more than one option is set to ``True``, then return a dictionary of metrics where the keys are "train",
  "valid", and "xval".
  
  :param str metric: name of the metric to retrieve.
  :param thresholds: If None, then the threshold maximizing the metric will be used (or minimizing it if the metric is an error).
  :param bool train: If ``True``, return the metric value for the training data.
  :param bool valid: If ``True``, return the metric value for the validation data.
  :param bool xval: If ``True``, return the metric value for each of the cross-validated splits.
  
  :returns: The metric values for the specified key(s).
  
  :examples:
  
  >>> cars = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/junit/cars_20mpg.csv")
  >>> >>> cars["economy_20mpg"] = cars["economy_20mpg"].asfactor()
  >>> r = cars[0].runif()
  >>> train = cars[r > .2]
  >>> valid = cars[r <= .2]
  >>> response_col = "economy_20mpg"
  >>> distribution = "bernoulli"
  >>> predictors = ["displacement","power","weight","acceleration","year"]
  # thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99])
  >>> thresholds = [0.01,0.5,0.99]
  >>> gbm = H2OGradientBoostingEstimator(nfolds=3,
  ...                                    distribution=distribution,
  ...                                    fold_assignment="Random")
  >>> gbm.train(y=response_col,
  ...           x=predictors,
  ...           validation_frame=valid,
  ...           training_frame=train)
  # allowable metrics are absolute_mcc, accuracy, precision,
  # f0point5, f1, f2, mean_per_class_accuracy, min_per_class_accuracy,
  # tns, fns, fps, tps, tnr, fnr, fpr, tpr, recall, sensitivity,
  # missrate, fallout, specificity
  >>> gbm.metric(metric='tpr', thresholds=thresholds)
docstr_tok: ["Get","the","metric","value","for","a","set","of","thresholds",".","If","all","are","``","False","``","(","default",")",",","then","return","the","training","metric","value",".","If","more","than","one","option","is","set","to","``","True","``",",","then","return","a","dictionary","of","metrics","where","the","keys","are","``","train","''",",","''","valid","''",",","and","``","xval","''",".",":","param","str","metric",":","name","of","the","metric","to","retrieve",".",":","param","thresholds",":","If","None",",","then","the","threshold","maximizing","the","metric","will","be","used","(","or","minimizing","it","if","the","metric","is","an","error",")",".",":","param","bool","train",":","If","``","True","``",",","return","the","metric","value","for","the","training","data",".",":","param","bool","valid",":","If","``","True","``",",","return","the","metric","value","for","the","validation","data",".",":","param","bool","xval",":","If","``","True","``",",","return","the","metric","value","for","each","of","the","cross-validated","splits",".",":","returns",":","The","metric","values","for","the","specified","key","(","s",")",".",":","examples",":",">",">",">","cars","=","h2o.import_file","(","``","https",":","\/\/s3.amazonaws.com\/h2o-public-test-data\/smalldata\/junit\/cars_20mpg.csv","''",")",">",">",">",">",">",">","cars","[","``","economy_20mpg","''","]","=","cars","[","``","economy_20mpg","''","]",".asfactor","(",")",">",">",">","r","=","cars","[","0","]",".runif","(",")",">",">",">","train","=","cars","[","r",">",".2","]",">",">",">","valid","=","cars","[","r","<","=",".2","]",">",">",">","response_col","=","``","economy_20mpg","''",">",">",">","distribution","=","``","bernoulli","''",">",">",">","predictors","=","[","``","displacement","''",",","''","power","''",",","''","weight","''",",","''","acceleration","''",",","''","year","''","]","#","thresholds","parameter","must","be","a","list","(","i.e",".","[","0.01",",","0.5",",","0.99","]",")",">",">",">","thresholds","=","[","0.01,0.5,0.99","]",">",">",">","gbm","=","H2OGradientBoostingEstimator","(","nfolds=3",",","...","distribution=distribution",",","...","fold_assignment=","''","Random","''",")",">",">",">","gbm.train","(","y=response_col",",","...","x=predictors",",","...","validation_frame=valid",",","...","training_frame=train",")","#","allowable","metrics","are","absolute_mcc",",","accuracy",",","precision",",","#","f0point5",",","f1",",","f2",",","mean_per_class_accuracy",",","min_per_class_accuracy",",","#","tns",",","fns",",","fps",",","tps",",","tnr",",","fnr",",","fpr",",","tpr",",","recall",",","sensitivity",",","#","missrate",",","fallout",",","specificity",">",">",">","gbm.metric","(","metric='tpr","'",",","thresholds=thresholds",")"]
code: def metric(
      self,
      metric,
      thresholds=None,
      train=False,
      valid=False,
      xval=False,
  ):
      """
      Get the metric value for a set of thresholds.
  
      If all are ``False`` (default), then return the training metric value.
      If more than one option is set to ``True``, then return a dictionary of metrics where the keys are "train",
      "valid", and "xval".
  
      :param str metric: name of the metric to retrieve.
      :param thresholds: If None, then the threshold maximizing the metric will be used (or minimizing it if the metric is an error).
      :param bool train: If ``True``, return the metric value for the training data.
      :param bool valid: If ``True``, return the metric value for the validation data.
      :param bool xval: If ``True``, return the metric value for each of the cross-validated splits.
  
      :returns: The metric values for the specified key(s).
  
      :examples:
  
      >>> cars = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/junit/cars_20mpg.csv")
      >>> >>> cars["economy_20mpg"] = cars["economy_20mpg"].asfactor()
      >>> r = cars[0].runif()
      >>> train = cars[r > .2]
      >>> valid = cars[r <= .2]
      >>> response_col = "economy_20mpg"
      >>> distribution = "bernoulli"
      >>> predictors = ["displacement","power","weight","acceleration","year"]
      # thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99])
      >>> thresholds = [0.01,0.5,0.99]
      >>> gbm = H2OGradientBoostingEstimator(nfolds=3,
      ...                                    distribution=distribution,
      ...                                    fold_assignment="Random")
      >>> gbm.train(y=response_col,
      ...           x=predictors,
      ...           validation_frame=valid,
      ...           training_frame=train)
      # allowable metrics are absolute_mcc, accuracy, precision,
      # f0point5, f1, f2, mean_per_class_accuracy, min_per_class_accuracy,
      # tns, fns, fps, tps, tnr, fnr, fpr, tpr, recall, sensitivity,
      # missrate, fallout, specificity
      >>> gbm.metric(metric='tpr', thresholds=thresholds)
      """
      tm = ModelBase._get_metrics(self, train, valid, xval)
      m = {}
      for k, v in tm.items():
          if v is None:
              m[k] = None
          elif hasattr(v, metric) and callable(getattr(v, metric)):
              m[k] = getattr(v, metric)(thresholds=thresholds)
          else:
              m[k] = v.metric(metric, thresholds=thresholds)
      return list(m.values())[0] if len(m) == 1 else m
  
imports: from h2o.utils.compatibility import *
  from h2o.exceptions import H2OValueError
  from h2o.model import ModelBase
  from h2o.model.extensions import has_extension
  from h2o.utils.metaclass import deprecated_params
  from h2o.utils.typechecks import assert_is_type
label_desc: Use image node_id 20 for calling the H2OBinomialModel obj's underlying member method code with example usage: obj.metric(metric, thresholds, train, valid, xval) and returns: unknown