Type DynamicRnnEstimator
Namespace tensorflow.contrib.learn
Parent Estimator
Interfaces IDynamicRnnEstimator
Dynamically unrolled RNN (deprecated). THIS CLASS IS DEPRECATED. See
[contrib/learn/README.md](https://www.tensorflow.org/code/tensorflow/contrib/learn/README.md)
for general migration instructions.
Methods
Properties
Public static methods
DynamicRnnEstimator NewDyn(object problem_type, object prediction_type, object sequence_feature_columns, object context_feature_columns, object num_classes, object num_units, ImplicitContainer<T> cell_type, ImplicitContainer<T> optimizer, ImplicitContainer<T> learning_rate, ImplicitContainer<T> predict_probabilities, object momentum, ImplicitContainer<T> gradient_clipping_norm, object dropout_keep_probabilities, object model_dir, object feature_engineering_fn, object config)
Initializes a `DynamicRnnEstimator`. The input function passed to this `Estimator` optionally contains keys
`RNNKeys.SEQUENCE_LENGTH_KEY`. The value corresponding to
`RNNKeys.SEQUENCE_LENGTH_KEY` must be vector of size `batch_size` where
entry `n` corresponds to the length of the `n`th sequence in the batch. The
sequence length feature is required for batches of varying sizes. It will be
used to calculate loss and evaluation metrics. If
`RNNKeys.SEQUENCE_LENGTH_KEY` is not included, all sequences are assumed to
have length equal to the size of dimension 1 of the input to the RNN. In order to specify an initial state, the input function must include keys
`STATE_PREFIX_i` for all `0 <= i < n` where `n` is the number of nested
elements in `cell.state_size`. The input function must contain values for
all state components or none of them. If none are included, then the default
(zero) state is used as an initial state. See the documentation for
`dict_to_state_tuple` and `state_tuple_to_dict` for further details.
The input function can call rnn_common.construct_rnn_cell() to obtain the
same cell type that this class will select from arguments to __init__. The `predict()` method of the `Estimator` returns a dictionary with keys
`STATE_PREFIX_i` for `0 <= i < n` where `n` is the number of nested elements
in `cell.state_size`, along with `PredictionKey.CLASSES` for problem type
`CLASSIFICATION` or `PredictionKey.SCORES` for problem type
`LINEAR_REGRESSION`. The value keyed by
`PredictionKey.CLASSES` or `PredictionKey.SCORES` has shape
`[batch_size, padded_length]` in the multi-value case and shape
`[batch_size]` in the single-value case. Here, `padded_length` is the
largest value in the `RNNKeys.SEQUENCE_LENGTH` `Tensor` passed as input.
Entry `[i, j]` is the prediction associated with sequence `i` and time step
`j`. If the problem type is `CLASSIFICATION` and `predict_probabilities` is
`True`, it will also include key`PredictionKey.PROBABILITIES`.
Parameters
-
object
problem_type - whether the `Estimator` is intended for a regression or classification problem. Value must be one of `ProblemType.CLASSIFICATION` or `ProblemType.LINEAR_REGRESSION`.
-
object
prediction_type - whether the `Estimator` should return a value for each step in the sequence, or just a single value for the final time step. Must be one of `PredictionType.SINGLE_VALUE` or `PredictionType.MULTIPLE_VALUE`.
-
object
sequence_feature_columns - An iterable containing all the feature columns describing sequence features. All items in the iterable should be instances of classes derived from `FeatureColumn`.
-
object
context_feature_columns - An iterable containing all the feature columns describing context features, i.e., features that apply across all time steps. All items in the set should be instances of classes derived from `FeatureColumn`.
-
object
num_classes - the number of classes for a classification problem. Only used when `problem_type=ProblemType.CLASSIFICATION`.
-
object
num_units - A list of integers indicating the number of units in the `RNNCell`s in each layer.
-
ImplicitContainer<T>
cell_type - A subclass of `RNNCell` or one of 'basic_rnn,' 'lstm' or 'gru'.
-
ImplicitContainer<T>
optimizer - The type of optimizer to use. Either a subclass of `Optimizer`, an instance of an `Optimizer`, a callback that returns an optimizer, or a string. Strings must be one of 'Adagrad', 'Adam', 'Ftrl', 'Momentum', 'RMSProp' or 'SGD'. See `layers.optimize_loss` for more details.
-
ImplicitContainer<T>
learning_rate - Learning rate. This argument has no effect if `optimizer` is an instance of an `Optimizer`.
-
ImplicitContainer<T>
predict_probabilities - A boolean indicating whether to predict probabilities for all classes. Used only if `problem_type` is `ProblemType.CLASSIFICATION`
-
object
momentum - Momentum value. Only used if `optimizer` is 'Momentum'.
-
ImplicitContainer<T>
gradient_clipping_norm - Parameter used for gradient clipping. If `None`, then no clipping is performed.
-
object
dropout_keep_probabilities - a list of dropout probabilities or `None`. If a list is given, it must have length `len(num_units) + 1`. If `None`, then no dropout is applied.
-
object
model_dir - The directory in which to save and restore the model graph, parameters, etc.
-
object
feature_engineering_fn - Takes features and labels which are the output of `input_fn` and returns features and labels which will be fed into `model_fn`. Please check `model_fn` for a definition of features and labels.
-
object
config - A `RunConfig` instance.