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: Creates the model prediction op.
  
  For this model, the hidden representation is the last layer of the MLP,
  before the logit computation. The predictions are unnormalized logits.
  
  Args:
    encoding: A tensor containing the model inputs. The first dimension is the
      batch size.
    is_train: A placeholder representing a boolean value that specifies if
      this model will be used for training or for test.
    **kwargs: Other keyword arguments.
  
  Returns:
    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.
    all_vars: A dictionary mapping from variable name to TensorFlow op
      containing all variables used in this model.
    reg_params: A dictionary mapping from a variable name to a Tensor of
      parameters which will be used for regularization.
docstr_tok: ["Creates","the","model","prediction","op",".","For","this","model",",","the","hidden","representation","is","the","last","layer","of","the","MLP",",","before","the","logit","computation",".","The","predictions","are","unnormalized","logits",".","Args",":","encoding",":","A","tensor","containing","the","model","inputs",".","The","first","dimension","is","the","batch","size",".","is_train",":","A","placeholder","representing","a","boolean","value","that","specifies","if","this","model","will","be","used","for","training","or","for","test",".","*","*","kwargs",":","Other","keyword","arguments",".","Returns",":","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",".","all_vars",":","A","dictionary","mapping","from","variable","name","to","TensorFlow","op","containing","all","variables","used","in","this","model",".","reg_params",":","A","dictionary","mapping","from","a","variable","name","to","a","Tensor","of","parameters","which","will","be","used","for","regularization","."]
code: def get_predictions_and_params(self, encoding, is_train, **kwargs):
      """Creates the model prediction op.
  
      For this model, the hidden representation is the last layer of the MLP,
      before the logit computation. The predictions are unnormalized logits.
  
      Args:
        encoding: A tensor containing the model inputs. The first dimension is the
          batch size.
        is_train: A placeholder representing a boolean value that specifies if
          this model will be used for training or for test.
        **kwargs: Other keyword arguments.
  
      Returns:
        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.
        all_vars: A dictionary mapping from variable name to TensorFlow op
          containing all variables used in this model.
        reg_params: A dictionary mapping from a variable name to a Tensor of
          parameters which will be used for regularization.
      """
      reg_params = {}
  
      # Build layers.
      with tf.variable_scope(self.name + "/prediction"):
          input_size = encoding.get_shape().dims[-1].value
          weights = tf.get_variable(
              "W_outputs",
              initializer=glorot((input_size, self.output_dim)),
              use_resource=True,
          )
          reg_params["W_outputs"] = weights
          biases = tf.get_variable(
              "b_outputs",
              initializer=tf.zeros([self.output_dim], dtype=tf.float32),
              use_resource=True,
          )
          predictions = tf.nn.xw_plus_b(
              encoding, weights, biases, name="predictions"
          )
          if self.is_binary_classification:
              predictions = predictions[:, 0]
  
          # Store model variables for easy access.
          variables = tf.get_collection(
              tf.GraphKeys.GLOBAL_VARIABLES,
              scope=tf.get_default_graph().get_name_scope(),
          )
          all_vars = {var.name: var for var in variables}
  
      return predictions, all_vars, reg_params
  
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 4 for calling the MLP obj's underlying member method code with example usage: obj.get_predictions_and_params(encoding, is_train) and returns: predictions,  all_vars,  reg_params