class_docstr: Generates a two DNN subnetworks at each iteration.
  
  The first DNN has an identical shape to the most recently added subnetwork
  in `previous_ensemble`. The second has the same shape plus one more dense
  layer on top. This is similar to the adaptive network presented in Figure 2 of
  [Cortes et al. ICML 2017](https://arxiv.org/abs/1607.01097), without the
  connections to hidden layers of networks from previous iterations.
docstr: Initializes a DNN `Generator`.
  
  Args:
    feature_columns: An iterable containing all the feature columns used by
      DNN models. All items in the set should be instances of classes derived
      from `FeatureColumn`.
    optimizer: An `Optimizer` instance for training both the subnetwork and
      the mixture weights.
    layer_size: Number of nodes in each hidden layer of the subnetwork
      candidates. Note that this parameter is ignored in a DNN with no hidden
      layers.
    initial_num_layers: Minimum number of layers for each DNN subnetwork. At
      iteration 0, the subnetworks will be `initial_num_layers` deep.
      Subnetworks at subsequent iterations will be at least as deep.
    learn_mixture_weights: Whether to solve a learning problem to find the
      best mixture weights, or use their default value according to the
      mixture weight type. When `False`, the subnetworks will return a no_op
      for the mixture weight train op.
    dropout: The dropout rate, between 0 and 1. E.g. "rate=0.1" would drop out
      10% of input units.
    seed: A random seed.
  
  Returns:
    An instance of `Generator`.
  
  Raises:
    ValueError: If feature_columns is empty.
    ValueError: If layer_size < 1.
    ValueError: If initial_num_layers < 0.
docstr_tok: ["Initializes","a","DNN","`","Generator","`",".","Args",":","feature_columns",":","An","iterable","containing","all","the","feature","columns","used","by","DNN","models",".","All","items","in","the","set","should","be","instances","of","classes","derived","from","`","FeatureColumn","`",".","optimizer",":","An","`","Optimizer","`","instance","for","training","both","the","subnetwork","and","the","mixture","weights",".","layer_size",":","Number","of","nodes","in","each","hidden","layer","of","the","subnetwork","candidates",".","Note","that","this","parameter","is","ignored","in","a","DNN","with","no","hidden","layers",".","initial_num_layers",":","Minimum","number","of","layers","for","each","DNN","subnetwork",".","At","iteration","0",",","the","subnetworks","will","be","`","initial_num_layers","`","deep",".","Subnetworks","at","subsequent","iterations","will","be","at","least","as","deep",".","learn_mixture_weights",":","Whether","to","solve","a","learning","problem","to","find","the","best","mixture","weights",",","or","use","their","default","value","according","to","the","mixture","weight","type",".","When","`","False","`",",","the","subnetworks","will","return","a","no_op","for","the","mixture","weight","train","op",".","dropout",":","The","dropout","rate",",","between","0","and","1",".","E.g",".","``","rate=0.1","''","would","drop","out","10","%","of","input","units",".","seed",":","A","random","seed",".","Returns",":","An","instance","of","`","Generator","`",".","Raises",":","ValueError",":","If","feature_columns","is","empty",".","ValueError",":","If","layer_size","<","1",".","ValueError",":","If","initial_num_layers","<","0","."]
code: def __init__(
      self,
      feature_columns,
      optimizer,
      layer_size=32,
      initial_num_layers=0,
      learn_mixture_weights=False,
      dropout=0.0,
      seed=None,
  ):
      """Initializes a DNN `Generator`.
  
      Args:
        feature_columns: An iterable containing all the feature columns used by
          DNN models. All items in the set should be instances of classes derived
          from `FeatureColumn`.
        optimizer: An `Optimizer` instance for training both the subnetwork and
          the mixture weights.
        layer_size: Number of nodes in each hidden layer of the subnetwork
          candidates. Note that this parameter is ignored in a DNN with no hidden
          layers.
        initial_num_layers: Minimum number of layers for each DNN subnetwork. At
          iteration 0, the subnetworks will be `initial_num_layers` deep.
          Subnetworks at subsequent iterations will be at least as deep.
        learn_mixture_weights: Whether to solve a learning problem to find the
          best mixture weights, or use their default value according to the
          mixture weight type. When `False`, the subnetworks will return a no_op
          for the mixture weight train op.
        dropout: The dropout rate, between 0 and 1. E.g. "rate=0.1" would drop out
          10% of input units.
        seed: A random seed.
  
      Returns:
        An instance of `Generator`.
  
      Raises:
        ValueError: If feature_columns is empty.
        ValueError: If layer_size < 1.
        ValueError: If initial_num_layers < 0.
      """
  
      if not feature_columns:
          raise ValueError("feature_columns must not be empty")
  
      if layer_size < 1:
          raise ValueError("layer_size must be >= 1")
  
      if initial_num_layers < 0:
          raise ValueError("initial_num_layers must be >= 0")
  
      self._initial_num_layers = initial_num_layers
      self._dnn_builder_fn = functools.partial(
          _SimpleDNNBuilder,
          feature_columns=feature_columns,
          optimizer=optimizer,
          layer_size=layer_size,
          learn_mixture_weights=learn_mixture_weights,
          dropout=dropout,
          seed=seed,
      )
  
file_path: adanet/adanet/examples/simple_dnn.py
imports: import functools
  import adanet
  import tensorflow.compat.v2
label_desc: Use image node_id 1 to create a new Generator object from inherited base classes: adanet.subnetwork with example: obj = Generator(feature_columns, optimizer, layer_size, initial_num_layers, learn_mixture_weights, dropout, seed)