【发布时间】:2016-12-01 08:23:41
【问题描述】:
我正在尝试理解,使用 RNN-LSTM 的时间序列,并在此处在线找到此代码:https://github.com/mouradmourafiq/tensorflow-lstm-regression
但是,在尝试在 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'
【问题讨论】:
-
看起来该存储库包含使用 TensorFlow API 的旧且不稳定版本的代码。我鼓励您在该存储库上打开 issue,以建议作者更新代码以使用最新的 API。
-
谢谢,我做到了。但是,如果我可以使用 RNN-LSTM 来预测 7 天的数据,你能帮我吗?价格预测等 - 我对此很陌生并且正在学习。
-
不幸的是,如果不更改该项目中的代码,将无法完成任何事情。一种可能性是阅读TensorFlow RNN tutorial 并学习如何使其适应您要解决的回归问题。
标签: tensorflow recurrent-neural-network