Reputation: 3043
When running this example in Anaconda 2.7:
import tensorflow.contrib.learn as skflow
def DNN_model(X, y):
"""This is DNN with 50, 20, 10 hidden layers, and dropout of 0.5 probability."""
layers = skflow.ops.dnn(X, [50, 30, 10], keep_prob=0.5)
return skflow.models.logistic_regression(layers, y)
clf = skflow.TensorFlowEstimator(model_fn=DNN_model, n_classes=3)
It dumps the following problem:
dnn() got an unexpected keyword argument 'keep_prob'
Tensorflow in Anaconda was installed using:
conda install -c jjhelmus tensorflow=0.9.0
Any idea what failed?
Upvotes: 2
Views: 1346
Reputation: 7171
In my case, keep_prob
change to rate
,
# tf.nn.dropout(D_Hidden, keep_prob=0.8)
tf.nn.dropout(D_Hidden, rate=0.2)
Please use rate instead of keep_prob . Rate should be set to rate = 1 - keep_prob. https://www.tensorflow.org/api_docs/python/tf/compat/v1/nn/dropout
Upvotes: 0
Reputation: 3043
According to the repository it seems this version is depreciated:
learn.ops.dnn is deprecated,please use contrib.layers.dnn.
However, different arguments should be passed:
def dnn(tensor_in, hidden_units, activation=nn.relu, dropout=None):
"""Creates fully connected deep neural network subgraph.
This is deprecated. Please use contrib.layers.dnn instead.
Args:
tensor_in: tensor or placeholder for input features.
hidden_units: list of counts of hidden units in each layer.
activation: activation function between layers. Can be None.
dropout: if not None, will add a dropout layer with given probability.
Returns:
A tensor which would be a deep neural network.
"""
Upvotes: 3