LostTech.TensorFlow : API Documentation

Type DNNEstimator

Namespace tensorflow.contrib.learn

Parent Estimator

Interfaces IDNNEstimator

A Estimator for TensorFlow DNN models with user specified _Head.

THIS CLASS IS DEPRECATED. See [contrib/learn/README.md](https://www.tensorflow.org/code/tensorflow/contrib/learn/README.md) for general migration instructions.

Example: Input of `fit` and `evaluate` should have following features, otherwise there will be a `KeyError`:

* if `weight_column_name` is not `None`, a feature with `key=weight_column_name` whose value is a `Tensor`. * for each `column` in `feature_columns`: - if `column` is a `SparseColumn`, a feature with `key=column.name` whose `value` is a `SparseTensor`. - if `column` is a `WeightedSparseColumn`, two features: the first with `key` the id column name, the second with `key` the weight column name. Both features' `value` must be a `SparseTensor`. - if `column` is a `RealValuedColumn`, a feature with `key=column.name` whose `value` is a `Tensor`.
Show Example
sparse_feature_a = sparse_column_with_hash_bucket(...)
            sparse_feature_b = sparse_column_with_hash_bucket(...) 

sparse_feature_a_emb = embedding_column(sparse_id_column=sparse_feature_a, ...) sparse_feature_b_emb = embedding_column(sparse_id_column=sparse_feature_b, ...) To create a DNNEstimator for binary classification, where estimator = DNNEstimator( feature_columns=[sparse_feature_a_emb, sparse_feature_b_emb], head=tf.contrib.learn.multi_class_head(n_classes=2), hidden_units=[1024, 512, 256])

If your label is keyed with "y" in your labels dict, and weights are keyed with "w" in features dict, and you want to enable centered bias, head = tf.contrib.learn.multi_class_head( n_classes=2, label_name="x", weight_column_name="w", enable_centered_bias=True) estimator = DNNEstimator( feature_columns=[sparse_feature_a_emb, sparse_feature_b_emb], head=head, hidden_units=[1024, 512, 256])

# Input builders def input_fn_train: # returns x, y (where y represents label's class index). pass estimator.fit(input_fn=input_fn_train)

def input_fn_eval: # returns x, y (where y represents label's class index). pass estimator.evaluate(input_fn=input_fn_eval) estimator.predict(x=x) # returns predicted labels (i.e. label's class index).

Methods

Properties

Public static methods

DNNEstimator NewDyn(object head, object hidden_units, object feature_columns, object model_dir, object optimizer, ImplicitContainer<T> activation_fn, object dropout, object gradient_clip_norm, object config, object feature_engineering_fn, object embedding_lr_multipliers, object input_layer_min_slice_size)

Initializes a `DNNEstimator` instance.
Parameters
object head
`Head` instance.
object hidden_units
List of hidden units per layer. All layers are fully connected. Ex. `[64, 32]` means first layer has 64 nodes and second one has 32.
object feature_columns
An iterable containing all the feature columns used by the model. All items in the set should be instances of classes derived from `FeatureColumn`.
object model_dir
Directory to save model parameters, graph and etc. This can also be used to load checkpoints from the directory into a estimator to continue training a previously saved model.
object optimizer
An instance of `tf.Optimizer` used to train the model. If `None`, will use an Adagrad optimizer.
ImplicitContainer<T> activation_fn
Activation function applied to each layer. If `None`, will use tf.nn.relu. Note that a string containing the unqualified name of the op may also be provided, e.g., "relu", "tanh", or "sigmoid".
object dropout
When not `None`, the probability we will drop out a given coordinate.
object gradient_clip_norm
A float > 0. If provided, gradients are clipped to their global norm with this clipping ratio. See tf.clip_by_global_norm for more details.
object config
`RunConfig` object to configure the runtime settings.
object feature_engineering_fn
Feature engineering function. Takes features and labels which are the output of `input_fn` and returns features and labels which will be fed into the model.
object embedding_lr_multipliers
Optional. A dictionary from `EmbeddingColumn` to a `float` multiplier. Multiplier will be used to multiply with learning rate for the embedding variables.
object input_layer_min_slice_size
Optional. The min slice size of input layer partitions. If not provided, will use the default of 64M.
Returns
DNNEstimator
A `DNNEstimator` estimator.

Public properties

object config get;

object config_dyn get;

string model_dir get;

object model_dir_dyn get;

object model_fn get;

object model_fn_dyn get;

object PythonObject get;