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錯誤。
問題是我不知道如何擺脫警告(不是錯誤)。