parameters: (model_fn)
return_statement: return _model_fn
docstring: Returns a model_fn with additional logistic metrics.
  
    Args:
      model_fn: Model function with the signature:
        `(features, labels, mode) -> (predictions, loss, train_op)`.
        Expects the returned predictions to be probabilities in [0.0, 1.0].
  
    Returns:
      model_fn that can be used with Estimator.
docstring_summary: Returns a model_fn with additional logistic metrics.
docstring_tokens: Returns a model_fn with additional logistic metrics .
function: def _get_model_fn_with_logistic_metrics(model_fn):
    """Returns a model_fn with additional logistic metrics.
  
    Args:
      model_fn: Model function with the signature:
        `(features, labels, mode) -> (predictions, loss, train_op)`.
        Expects the returned predictions to be probabilities in [0.0, 1.0].
  
    Returns:
      model_fn that can be used with Estimator.
    """
  
    def _model_fn(features, labels, mode, params):
      """Model function that appends logistic evaluation metrics."""
      thresholds = params.get('thresholds') or [.5]
  
      predictions, loss, train_op = model_fn(features, labels, mode)
      if mode == model_fn_lib.ModeKeys.EVAL:
        eval_metric_ops = _make_logistic_eval_metric_ops(
            labels=labels,
            predictions=predictions,
            thresholds=thresholds)
      else:
        eval_metric_ops = None
      return model_fn_lib.ModelFnOps(
          mode=mode,
          predictions=predictions,
          loss=loss,
          train_op=train_op,
          eval_metric_ops=eval_metric_ops,
          output_alternatives={
              'head': (constants.ProblemType.LOGISTIC_REGRESSION, {
                  'predictions': predictions
              })
          })
  
    return _model_fn
function_tokens: def _get_model_fn_with_logistic_metrics ( model_fn ) : def _model_fn ( features , labels , mode , params ) : """Model function that appends logistic evaluation metrics.""" thresholds = params . get ( 'thresholds' ) or [ .5 ] predictions , loss , train_op = model_fn ( features , labels , mode ) if mode == model_fn_lib . ModeKeys . EVAL : eval_metric_ops = _make_logistic_eval_metric_ops ( labels = labels , predictions = predictions , thresholds = thresholds ) else : eval_metric_ops = None return model_fn_lib . ModelFnOps ( mode = mode , predictions = predictions , loss = loss , train_op = train_op , eval_metric_ops = eval_metric_ops , output_alternatives = { 'head' : ( constants . ProblemType . LOGISTIC_REGRESSION , { 'predictions' : predictions } ) } ) return _model_fn