class_docstr: Deep Neural Network (DNN) scoring based univariate ranking network.
docstr: Initializes an instance of DNN ranking network.
  
  This network consists of feedforward linear units passed through a
  non-linear
  activation. The hidden size of the linear units and the activation are
  specified by the user.
  
  Args:
    context_feature_columns: A dict containing all the context feature columns
      used by the network. Keys are feature names, and values are instances of
      classes derived from `_FeatureColumn`.
    example_feature_columns: A dict containing all the example feature columns
      used by the network. Keys are feature names, and values are instances of
      classes derived from `_FeatureColumn`.
    hidden_layer_dims: Iterable of number hidden units per layer. All layers
      are fully connected. Ex. `[64, 32]` means first layer has 64 nodes and
      second one has 32.
    activation: Activation function applied to each layer. If `None`, will use
      an identity activation, which is default behavior in Keras activations.
    use_batch_norm: Whether to use batch normalization after each hidden
      layer.
    batch_norm_moment: Momentum for the moving average in batch normalization.
    dropout: When not `None`, the probability we will drop out a given
      coordinate.
    name: name of Keras network.
    **kwargs: keyword arguments.
  
  Raises:
    `ValueError` if `example_feature_columns` or `hidden_layer_dims` is empty.
docstr_tok: ["Initializes","an","instance","of","DNN","ranking","network",".","This","network","consists","of","feedforward","linear","units","passed","through","a","non-linear","activation",".","The","hidden","size","of","the","linear","units","and","the","activation","are","specified","by","the","user",".","Args",":","context_feature_columns",":","A","dict","containing","all","the","context","feature","columns","used","by","the","network",".","Keys","are","feature","names",",","and","values","are","instances","of","classes","derived","from","`","_FeatureColumn","`",".","example_feature_columns",":","A","dict","containing","all","the","example","feature","columns","used","by","the","network",".","Keys","are","feature","names",",","and","values","are","instances","of","classes","derived","from","`","_FeatureColumn","`",".","hidden_layer_dims",":","Iterable","of","number","hidden","units","per","layer",".","All","layers","are","fully","connected",".","Ex",".","`","[","64",",","32","]","`","means","first","layer","has","64","nodes","and","second","one","has","32.","activation",":","Activation","function","applied","to","each","layer",".","If","`","None","`",",","will","use","an","identity","activation",",","which","is","default","behavior","in","Keras","activations",".","use_batch_norm",":","Whether","to","use","batch","normalization","after","each","hidden","layer",".","batch_norm_moment",":","Momentum","for","the","moving","average","in","batch","normalization",".","dropout",":","When","not","`","None","`",",","the","probability","we","will","drop","out","a","given","coordinate",".","name",":","name","of","Keras","network",".","*","*","kwargs",":","keyword","arguments",".","Raises",":","`","ValueError","`","if","`","example_feature_columns","`","or","`","hidden_layer_dims","`","is","empty","."]
code: def __init__(
      self,
      context_feature_columns=None,
      example_feature_columns=None,
      hidden_layer_dims=None,
      activation=None,
      use_batch_norm=True,
      batch_norm_moment=0.999,
      dropout=0.5,
      name="dnn_ranking_network",
      **kwargs,
  ):
      """Initializes an instance of DNN ranking network.
  
      This network consists of feedforward linear units passed through a
      non-linear
      activation. The hidden size of the linear units and the activation are
      specified by the user.
  
      Args:
        context_feature_columns: A dict containing all the context feature columns
          used by the network. Keys are feature names, and values are instances of
          classes derived from `_FeatureColumn`.
        example_feature_columns: A dict containing all the example feature columns
          used by the network. Keys are feature names, and values are instances of
          classes derived from `_FeatureColumn`.
        hidden_layer_dims: Iterable of number hidden units per layer. All layers
          are fully connected. Ex. `[64, 32]` means first layer has 64 nodes and
          second one has 32.
        activation: Activation function applied to each layer. If `None`, will use
          an identity activation, which is default behavior in Keras activations.
        use_batch_norm: Whether to use batch normalization after each hidden
          layer.
        batch_norm_moment: Momentum for the moving average in batch normalization.
        dropout: When not `None`, the probability we will drop out a given
          coordinate.
        name: name of Keras network.
        **kwargs: keyword arguments.
  
      Raises:
        `ValueError` if `example_feature_columns` or `hidden_layer_dims` is empty.
  
      """
      if not example_feature_columns or not hidden_layer_dims:
          raise ValueError(
              "example_feature_columns or hidden_layer_dims must not "
              "be empty."
          )
      super(DNNRankingNetwork, self).__init__(
          context_feature_columns=context_feature_columns,
          example_feature_columns=example_feature_columns,
          name=name,
          **kwargs,
      )
      self._hidden_layer_dims = [int(d) for d in hidden_layer_dims]
      self._activation = activation
      self._use_batch_norm = use_batch_norm
      self._batch_norm_moment = batch_norm_moment
      self._dropout = dropout
  
      layers = []
      if self._use_batch_norm:
          layers.append(
              tf.keras.layers.BatchNormalization(
                  momentum=self._batch_norm_moment
              )
          )
      for _, layer_width in enumerate(self._hidden_layer_dims):
          layers.append(tf.keras.layers.Dense(units=layer_width))
          if self._use_batch_norm:
              layers.append(
                  tf.keras.layers.BatchNormalization(
                      momentum=self._batch_norm_moment
                  )
              )
          layers.append(
              tf.keras.layers.Activation(activation=self._activation)
          )
          layers.append(tf.keras.layers.Dropout(rate=self._dropout))
  
      self._scoring_layers = layers
  
      self._output_score_layer = tf.keras.layers.Dense(units=1)
  
imports: import tensorflow.compat.v2
  from tensorflow_ranking.python.keras import network
label_desc: Use image node_id 1 to create a new DNNRankingNetwork object from inherited base classes: network_lib with example: obj = DNNRankingNetwork(context_feature_columns, example_feature_columns, hidden_layer_dims, activation, use_batch_norm, batch_norm_moment, dropout, name)