class_docstr: Multilayer Perceptron for binary and multi-class classification.
  
  Attributes:
    output_dim: Integer representing the number of classes.
    hidden_sizes: List containing the sizes of the hidden layers.
    activation: An activation function to apply to the output of each hidden
      layer.
    aggregation: String representing an aggregation operation that could be
      applied to the inputs. Valid options: None, `add`. If None, then no
      aggregation is performed. If `add`, the first half of the features
      dimension is added to the second half (see the `_aggregate` function
      for details).
    hidden_aggregation: A tuple or list of integers representing the number of
      hidden units in each layer of the projection network described above.
    is_binary_classification: Boolean specifying if this is model for
      binary classification. If so, it uses a different loss function and
      returns predictions with a single dimension, batch size.
    name: String representing the model name.
class_docstr_tok: ["Multilayer","Perceptron","for","binary","and","multi-class","classification",".","Attributes",":","output_dim",":","Integer","representing","the","number","of","classes",".","hidden_sizes",":","List","containing","the","sizes","of","the","hidden","layers",".","activation",":","An","activation","function","to","apply","to","the","output","of","each","hidden","layer",".","aggregation",":","String","representing","an","aggregation","operation","that","could","be","applied","to","the","inputs",".","Valid","options",":","None",",","`","add","`",".","If","None",",","then","no","aggregation","is","performed",".","If","`","add","`",",","the","first","half","of","the","features","dimension","is","added","to","the","second","half","(","see","the","`","_aggregate","`","function","for","details",")",".","hidden_aggregation",":","A","tuple","or","list","of","integers","representing","the","number","of","hidden","units","in","each","layer","of","the","projection","network","described","above",".","is_binary_classification",":","Boolean","specifying","if","this","is","model","for","binary","classification",".","If","so",",","it","uses","a","different","loss","function","and","returns","predictions","with","a","single","dimension",",","batch","size",".","name",":","String","representing","the","model","name","."]
docstr: Converts predictions to probabilities.
  
  Args:
    predictions: A tensor of logits. For multiclass classification its shape
      is (num_samples, num_classes), where the second dimension contains a
      logit per class. For binary classification, its shape is (num_samples,),
      where each element is the probability of class 1 for that sample.
  
  Returns:
    A tensor of the same shape as predictions, with values between [0, 1]
  representing probabilities.
docstr_tok: ["Converts","predictions","to","probabilities",".","Args",":","predictions",":","A","tensor","of","logits",".","For","multiclass","classification","its","shape","is","(","num_samples",",","num_classes",")",",","where","the","second","dimension","contains","a","logit","per","class",".","For","binary","classification",",","its","shape","is","(","num_samples",",",")",",","where","each","element","is","the","probability","of","class","1","for","that","sample",".","Returns",":","A","tensor","of","the","same","shape","as","predictions",",","with","values","between","[","0",",","1","]","representing","probabilities","."]
code: def normalize_predictions(self, predictions):
      """Converts predictions to probabilities.
  
      Args:
        predictions: A tensor of logits. For multiclass classification its shape
          is (num_samples, num_classes), where the second dimension contains a
          logit per class. For binary classification, its shape is (num_samples,),
          where each element is the probability of class 1 for that sample.
  
      Returns:
        A tensor of the same shape as predictions, with values between [0, 1]
      representing probabilities.
      """
      if self.is_binary_classification:
          return tf.nn.sigmoid(predictions)
      return tf.nn.softmax(predictions, axis=-1)
  
file_path: neural-structured-learning/research/gam/gam/models/mlp.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from .models_base import glorot
  from .models_base import Model
  import numpy
  import tensorflow
label_desc: Use image node_id 6 for calling the MLP obj's underlying member method code with example usage: obj.normalize_predictions(predictions) and returns: tf, tf