lserlohn
lserlohn

Reputation: 6216

how to change activation function in DNNClassifier in tensorflow r0.9?

I couldn't find a way to change activation function in DNNClassifier. The document is not well written. I want to do something like:

  classifier = learn.DNNClassifier(hidden_units=[8,16,8], n_classes=2, activation_fn=relu)

But there is no activation_fn in the fucntion, so I can hardly change it.

Can anyone help? Thanks,

Upvotes: 1

Views: 2114

Answers (1)

leElia
leElia

Reputation: 19

So there are a bunch of different activation functions out there. The dictionary below just gives you the more common ones. You can find out about all activation function here: https://www.tensorflow.org/versions/r0.11/api_docs/python/nn.html

activation = {'relu': tf.nn.relu,
          'tanh': tf.nn.tanh,
          'sigmoid': tf.nn.sigmoid,
          'elu': tf.nn.elu,
          'softplus': tf.nn.softplus,
          'softsign': tf.nn.softsign,
          'relu6': tf.nn.relu6,
          'dropout': tf.nn.dropout}

Upvotes: 1

Related Questions