2017-03-17 202 views
1

当制作DNN回归和Undeprecating tensorflow

print(list(estimator.predict({"p": np.array([[0.,0.],[1.,0.],[0.,1.],[1.,1.]])}))) 

预测值,这是控制台输出:

WARNING:tensorflow:From "...\tensorflow\contrib\learn\python\learn\estimators\dnn.py":692: calling BaseEstimator.predict (from tensorflow.contrib.learn.python.learn.estimators.estimator) with x is deprecated and will be removed after 2016-12-01. 
Instructions for updating: 
Estimator is decoupled from Scikit Learn interface by moving into 
separate class SKCompat. Arguments x, y and batch_size are only 
available in the SKCompat class, Estimator will only accept input_fn. 
Example conversion: 
    est = Estimator(...) -> est = SKCompat(Estimator(...)) 

所以我把头成dnn.py 692线,这就是我找到

preds = super(DNNRegressor, self).predict(
     x=x, 
     input_fn=input_fn, 
     batch_size=batch_size, 
     outputs=[key], 
     as_iterable=as_iterable) 

所以下面从错误的建议,并假设super(DNNRegressor, self)Estimator我只是做了

preds = estimator.SKCompat(super(DNNRegressor, self)).predict(...) 

但这样做,我得到

TypeError: predict() got an unexpected keyword argument 'input_fn' 

,看起来像它不是一个tensorflow错误。

问题是我不知道如何摆脱警告(不是错误)。

回答

1

这部分Github tree正在积极开发中。一旦Estimator类被移动到版本为r1.1的日程安排tf.core中,我预计此警告消息将消失。我发现Martin Wicke的2017 TensorFlow Dev Summit video对于高层次TensorFlow的未来计划非常有用。