parameters: (examples, unused_features, predictions)
return_statement: return default_signature, {}
docstring: Creates logistic regression signature from given examples and predictions.
  
    Args:
      examples: `Tensor`.
      unused_features: `dict` of `Tensor`s.
      predictions: `Tensor` of shape [batch_size, 2] of predicted probabilities or
        dict that contains the probabilities tensor as in
        {'probabilities', `Tensor`}.
  
    Returns:
      Tuple of default regression signature and named signature.
  
    Raises:
      ValueError: If examples is `None`.
docstring_summary: Creates logistic regression signature from given examples and predictions.
docstring_tokens: Creates logistic regression signature from given examples and predictions .
function: def logistic_regression_signature_fn(examples, unused_features, predictions):
    """Creates logistic regression signature from given examples and predictions.
  
    Args:
      examples: `Tensor`.
      unused_features: `dict` of `Tensor`s.
      predictions: `Tensor` of shape [batch_size, 2] of predicted probabilities or
        dict that contains the probabilities tensor as in
        {'probabilities', `Tensor`}.
  
    Returns:
      Tuple of default regression signature and named signature.
  
    Raises:
      ValueError: If examples is `None`.
    """
    if examples is None:
      raise ValueError('examples cannot be None when using this signature fn.')
  
    if isinstance(predictions, dict):
      predictions_tensor = predictions['probabilities']
    else:
      predictions_tensor = predictions
    # predictions should have shape [batch_size, 2] where first column is P(Y=0|x)
    # while second column is P(Y=1|x). We are only interested in the second
    # column for inference.
    predictions_shape = predictions_tensor.get_shape()
    predictions_rank = len(predictions_shape)
    if predictions_rank != 2:
      logging.fatal(
          'Expected predictions to have rank 2, but received predictions with '
          'rank: {} and shape: {}'.format(predictions_rank, predictions_shape))
    if predictions_shape[1] != 2:
      logging.fatal(
          'Expected predictions to have 2nd dimension: 2, but received '
          'predictions with 2nd dimension: {} and shape: {}. Did you mean to use '
          'regression_signature_fn or classification_signature_fn_with_prob '
          'instead?'.format(predictions_shape[1], predictions_shape))
  
    positive_predictions = predictions_tensor[:, 1]
    default_signature = exporter.regression_signature(
        input_tensor=examples, output_tensor=positive_predictions)
    return default_signature, {}
function_tokens: def logistic_regression_signature_fn ( examples , unused_features , predictions ) : if examples is None : raise ValueError ( 'examples cannot be None when using this signature fn.' ) if isinstance ( predictions , dict ) : predictions_tensor = predictions [ 'probabilities' ] else : predictions_tensor = predictions # predictions should have shape [batch_size, 2] where first column is P(Y=0|x) # while second column is P(Y=1|x). We are only interested in the second # column for inference. predictions_shape = predictions_tensor . get_shape ( ) predictions_rank = len ( predictions_shape ) if predictions_rank != 2 : logging . fatal ( 'Expected predictions to have rank 2, but received predictions with ' 'rank: {} and shape: {}' . format ( predictions_rank , predictions_shape ) ) if predictions_shape [ 1 ] != 2 : logging . fatal ( 'Expected predictions to have 2nd dimension: 2, but received ' 'predictions with 2nd dimension: {} and shape: {}. Did you mean to use ' 'regression_signature_fn or classification_signature_fn_with_prob ' 'instead?' . format ( predictions_shape [ 1 ] , predictions_shape ) ) positive_predictions = predictions_tensor [ : , 1 ] default_signature = exporter . regression_signature ( input_tensor = examples , output_tensor = positive_predictions ) return default_signature , { }