2016-12-01 89 views
0

我想明白了,時間序列使用RNN-LSTM,發現這個代碼在網上瀏覽:https://github.com/mouradmourafiq/tensorflow-lstm-regressionRNN-LSTM時間序列Tensorflow 0.12錯誤

但是,試圖在v0.12我運行得到這些錯誤。我如何解決這個錯誤?

WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/monitors.py:320 in __init__.: __init__ (from tensorfl 
     ow.contrib.learn.python.learn.monitors) is deprecated and will be removed after 2016-12-05. 
     Instructions for updating: 
     Monitors are deprecated. Please use tf.train.SessionRunHook. 
     WARNING:tensorflow:From lstm_trend.py:48 in <module>.: calling fit (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(...)) 
     WARNING:tensorflow:From lstm_trend.py:48 in <module>.: calling fit (from tensorflow.contrib.learn.python.learn.estimators.estimator) with y 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(...)) 
     WARNING:tensorflow:From lstm_trend.py:48 in <module>.: calling fit (from tensorflow.contrib.learn.python.learn.estimators.estimator) with batch_size is de 
     precated 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(...)) 
     Traceback (most recent call last): 
      File "lstm_trend.py", line 48, in <module> 
      regressor.fit(X['train'], y['train'],monitors=[validation_monitor],batch_size=BATCH_SIZE,steps=TRAINING_STEPS) 
      File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/util/deprecation.py", line 191, in new_func 
      return func(*args, **kwargs) 
      File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 355, in fit 
      max_steps=max_steps) 
      File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 699, in _train_model 
      train_ops = self._get_train_ops(features, labels) 
      File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 1052, in _get_train_ops 
      return self._call_model_fn(features, labels, model_fn_lib.ModeKeys.TRAIN) 
      File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 1023, in _call_model_fn 
      model_fn_results = self._model_fn(features, labels) 
      File "/home/username/rtw-rnn/lstm_model.py", line 122, in _lstm_model 
      output = dnn_layers(output[-1], dense_layers) 
      File "/home/username/rtw-rnn/lstm_model.py", line 114, in dnn_layers 
      return learn.ops.dnn(input_layers, layers) 
     AttributeError: 'module' object has no attribute 'dnn' 
+0

看起來存儲庫包含使用TensorFlow API的舊版本和不穩定版本的代碼。我建議您在該存儲庫上打開[issue](https://github.com/mouradmourafiq/tensorflow-lstm-regression/issues),以表明作者更新代碼以使用最新的API。 – mrry

+0

謝謝,我做到了。但是,如果我可以使用RNN-LSTM來預測例如7天的數據,那麼您能否幫助我?價格預測等 - 我對此很新,並且正在學習。 – user6083088

+1

不幸的是,沒有改變該項目中的代碼就沒有什麼可以做的。一種可能性是閱讀[TensorFlow RNN教程](https://www.tensorflow.org/versions/r0.12/tutorials/recurrent/index.html),並學習如何使其適應您所遇到的迴歸問題試圖解決。 – mrry

回答

1

我將框架更改爲v0.10.0,它正在工作。