tf.contrib.learn.DNNClassifier.__init__(hidden_units, feature_columns, model_dir=None, n_classes=2, weight_column_name=None, optimizer=None, activation_fn=relu, dropout=None, gradient_clip_norm=None, enable_centered_bias=None, config=None)
Initializes a DNNClassifier instance.
Args:
-
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. -
feature_columns
: An iterable containing all the feature columns used by the model. All items in the set should be instances of classes derived fromFeatureColumn
. -
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. -
n_classes
: number of target classes. Default is binary classification. It must be greater than 1. -
weight_column_name
: A string defining feature column name representing weights. It is used to down weight or boost examples during training. It will be multiplied by the loss of the example. -
optimizer
: An instance oftf.Optimizer
used to train the model. IfNone
, will use an Adagrad optimizer. -
activation_fn
: Activation function applied to each layer. IfNone
, will usetf.nn.relu
. -
dropout
: When notNone
, the probability we will drop out a given coordinate. -
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. -
enable_centered_bias
: A bool. If True, estimator will learn a centered bias variable for each class. Rest of the model structure learns the residual after centered bias. -
config
:RunConfig
object to configure the runtime settings.
Returns:
A DNNClassifier
estimator.
Raises:
-
ValueError
: Ifn_classes
< 2.
Please login to continue.