Coder Social home page Coder Social logo

stock-market-forecasting's Introduction

https://arxiv.org/abs/2004.10178
Pushpendu Ghosh, Ariel Neufeld, Jajati K Sahoo

We design a highly profitable trading stratergy and employ random forests and LSTM networks (more precisely CuDNNLSTM) to analyze their effectiveness in forecasting out-of-sample directional movements of constituent stocks of the S&P 500, for intraday trading, from January 1993 till December 2018.

Bibtex

@article{ghosh2021forecasting,
  title={Forecasting directional movements of stock prices for intraday trading using LSTM and random forests},
  author={Ghosh, Pushpendu and Neufeld, Ariel and Sahoo, Jajati Keshari},
  journal={Finance Research Letters},
  pages={102280},
  year={2021},
  publisher={Elsevier}
}

Requirements

pip install scikit-learn==0.20.4
pip install tensorflow==1.14.0

Plots

We plot three important metrics to quantify the effectiveness of our model: Intraday-240,3-LSTM.py and Intraday-240,3-RF.py, in the period January 1993 till December 2018.
Intraday LSTM: Intraday-240,3-LSTM.py
Intraday RF: Intraday-240,3-RF.py
Next Day LSTM, krauss18: NextDay-240,1-LSTM.py [1]
Next Day RF, krauss17: NextDay-240,1-RF.py [2]

Cumulative Money growth (after transaction cost)

Average daily returns (after transaction cost)

Average (Annualized) Sharpe ratio (after transaction cost)

Appendix

Feature Importance

This figure analyzes the Sharpe Ratio achieved when single features are used instead of our 3-features for the same intraday trading strategy. It hence analyzes which single feature is important.
The result suggest that or (returns from close price to next day open price) has the highest importance. This is justifiable by the fact that it is the only feature which considers the latest available data (the trading day's open price) at the time of making the trading decision. We also see that our 3-features setting achieves the highest Sharpe Ratio and hence outperforms each single feature.

LSTM hyperparameter tuning

We see that the amount of 25 cells for our chosen LSTM architecture to be at least as good as other amounts between 5 and 100. We have chosen 25 cells also for the ease of comparison with Fischer & Krauss (2018)

Benchmark against other LSTM architectures

We consider various new LSTM architectures. Note that the other LSTM architectures involve much more parameters than the one we chose for our empirical study and do not achieve better results in terms of Sharpe Ratio. Moreover, we also compare our LSTM architecture with GRU, which is a relatively simpler variation of LSTM, and see that it generates reasonably good but still slightly lower Sharpe ratio than our chosen LSTM architecture.

References to the LSTM models:

  1. Single Layer GRU: https://arxiv.org/abs/1412.3555
  2. Stacked LSTM: https://www.sciencedirect.com/science/article/pii/S1877050920304865
  3. Stacked Residual LSTM: https://arxiv.org/abs/1610.03098

Acknowledgements

The first author gratefully acknowledges the NTU-India Connect Research Internship Programme which allowed him to carry out part of this research project while visiting the Nanyang Technological University, Singapore.
The second author gratefully acknowledges financial support by his Nanyang Assistant Professorship Grant (NAP Grant) Machine Learning based Algorithms in Finance and Insurance.

References

[1] Fischer, Thomas, and Christopher Krauss. "Deep learning with long short-term memory networks for financial market predictions." European Journal of Operational Research 270.2 (2018): 654-669.
[2] Krauss, Christopher, Xuan Anh Do, and Nicolas Huck. "Deep neural networks, gradient-boosted trees, random forests: Statistical arbitrage on the S&P 500." European Journal of Operational Research 259.2 (2017): 689-702.

stock-market-forecasting's People

Contributors

pushpendughosh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stock-market-forecasting's Issues

ImportError: cannot import name 'CuDNNLSTM' from 'tensorflow.keras.layers'

Issue Description

The model is not running producing error while importing CuDNNLSTM. It is also indicating missing libraries.

Error Message

2023-02-22 12:27:22.207311: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-02-22 12:27:23.906938: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/nvidia/lib:/usr/local/nvidia/lib64
2023-02-22 12:27:23.907095: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/nvidia/lib:/usr/local/nvidia/lib64
2023-02-22 12:27:23.907120: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
Traceback (most recent call last):
File "/content/drive/MyDrive/Stock-market-forecasting/Intraday-240,1-LSTM.py", line 11, in
from tensorflow.keras.layers import CuDNNLSTM, Dropout,Dense,Input,add
ImportError: cannot import name 'CuDNNLSTM' from 'tensorflow.keras.layers' (/usr/local/lib/python3.8/dist-packages/keras/api/_v2/keras/layers/init.py)

ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type float).

Error Desciption

ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type float).

Details


ValueError Traceback (most recent call last)
D:\deeplearning\Temp\ipykernel_5864\2961666884.py in
26 print(train_data.shape,test_data.shape,time.time()-start)
27
---> 28 model,predictions = trainer(train_data,test_data)
29 # returns = simulate(test_data,predictions)
30 # returns.to_csv(result_folder+'/avg_daily_rets-'+str(test_year)+'.csv')

D:\deeplearning\Temp\ipykernel_5864\3168391516.py in trainer(train_data, test_data)
28 validation_split=0.2,
29 callbacks=callbacks,
---> 30 batch_size=512
31 )
32

C:\ProgramData\miniconda3\envs\tf\lib\site-packages\tensorflow_core\python\keras\engine\training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_freq, max_queue_size, workers, use_multiprocessing, **kwargs)
817 max_queue_size=max_queue_size,
818 workers=workers,
--> 819 use_multiprocessing=use_multiprocessing)
820
821 def evaluate(self,

C:\ProgramData\miniconda3\envs\tf\lib\site-packages\tensorflow_core\python\keras\engine\training_v2.py in fit(self, model, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_freq, max_queue_size, workers, use_multiprocessing, **kwargs)
233 max_queue_size=max_queue_size,
234 workers=workers,
--> 235 use_multiprocessing=use_multiprocessing)
236
237 total_samples = _get_total_number_of_samples(training_data_adapter)

C:\ProgramData\miniconda3\envs\tf\lib\site-packages\tensorflow_core\python\keras\engine\training_v2.py in _process_training_inputs(model, x, y, batch_size, epochs, sample_weights, class_weights, steps_per_epoch, validation_split, validation_data, validation_steps, shuffle, distribution_strategy, max_queue_size, workers, use_multiprocessing)
567 sample_weight_modes=sample_weight_modes,
568 shuffle=shuffle,
--> 569 distribution_strategy=distribution_strategy)
570
571 val_adapter = adapter_cls(

C:\ProgramData\miniconda3\envs\tf\lib\site-packages\tensorflow_core\python\keras\engine\data_adapter.py in init(self, x, y, sample_weights, sample_weight_modes, batch_size, epochs, steps, shuffle, **kwargs)
355 indices_dataset = indices_dataset.flat_map(slice_batch_indices)
356
--> 357 dataset = self.slice_inputs(indices_dataset, inputs)
358
359 if shuffle == "batch":

C:\ProgramData\miniconda3\envs\tf\lib\site-packages\tensorflow_core\python\keras\engine\data_adapter.py in slice_inputs(self, indices_dataset, inputs)
381 dataset = dataset_ops.DatasetV2.zip((
382 indices_dataset,
--> 383 dataset_ops.DatasetV2.from_tensors(inputs).repeat()
384 ))
385

C:\ProgramData\miniconda3\envs\tf\lib\site-packages\tensorflow_core\python\data\ops\dataset_ops.py in from_tensors(tensors)
564 Dataset: A Dataset.
565 """
--> 566 return TensorDataset(tensors)
567
568 @staticmethod

C:\ProgramData\miniconda3\envs\tf\lib\site-packages\tensorflow_core\python\data\ops\dataset_ops.py in init(self, element)
2763 def init(self, element):
2764 """See Dataset.from_tensors() for details."""
-> 2765 element = structure.normalize_element(element)
2766 self._structure = structure.type_spec_from_value(element)
2767 self._tensors = structure.to_tensor_list(self._structure, element)

C:\ProgramData\miniconda3\envs\tf\lib\site-packages\tensorflow_core\python\data\util\structure.py in normalize_element(element)
111 else:
112 normalized_components.append(
--> 113 ops.convert_to_tensor(t, name="component_%d" % i))
114 return nest.pack_sequence_as(element, normalized_components)
115

C:\ProgramData\miniconda3\envs\tf\lib\site-packages\tensorflow_core\python\framework\ops.py in convert_to_tensor(value, dtype, name, as_ref, preferred_dtype, dtype_hint, ctx, accepted_result_types)
1312
1313 if ret is None:
-> 1314 ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
1315
1316 if ret is NotImplemented:

C:\ProgramData\miniconda3\envs\tf\lib\site-packages\tensorflow_core\python\framework\tensor_conversion_registry.py in _default_conversion_function(failed resolving arguments)
50 def _default_conversion_function(value, dtype, name, as_ref):
51 del as_ref # Unused.
---> 52 return constant_op.constant(value, dtype, name=name)
53
54

C:\ProgramData\miniconda3\envs\tf\lib\site-packages\tensorflow_core\python\framework\constant_op.py in constant(value, dtype, shape, name)
256 """
257 return _constant_impl(value, dtype, shape, name, verify_shape=False,
--> 258 allow_broadcast=True)
259
260

C:\ProgramData\miniconda3\envs\tf\lib\site-packages\tensorflow_core\python\framework\constant_op.py in _constant_impl(value, dtype, shape, name, verify_shape, allow_broadcast)
264 ctx = context.context()
265 if ctx.executing_eagerly():
--> 266 t = convert_to_eager_tensor(value, ctx, dtype)
267 if shape is None:
268 return t

C:\ProgramData\miniconda3\envs\tf\lib\site-packages\tensorflow_core\python\framework\constant_op.py in convert_to_eager_tensor(value, ctx, dtype)
94 dtype = dtypes.as_dtype(dtype).as_datatype_enum
95 ctx.ensure_initialized()
---> 96 return ops.EagerTensor(value, ctx.device_name, dtype)
97
98

KeyError: 'S783' when run NextDay-240,1-LSTM.py

(tensorflow) (base) elife@ubuntu:~/work/Trading/Stock-market-forecasting$ python NextDay-240,1-LSTM.py
/usr/lib/python2.7/dist-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
WARNING:tensorflow:From NextDay-240,1-LSTM.py:10: The name tf.keras.layers.CuDNNLSTM is deprecated. Please use tf.compat.v1.keras.layers.CuDNNLSTM instead.

WARNING:tensorflow:From NextDay-240,1-LSTM.py:22: The name tf.set_random_seed is deprecated. Please use tf.compat.v1.set_random_seed instead.


1993

Traceback (most recent call last):
File "NextDay-240,1-LSTM.py", line 181, in
st_train_data,st_test_data = create_stock_data(df,st)
File "NextDay-240,1-LSTM.py", line 137, in create_stock_data
daily_change = df[st].pct_change()
File "/home/elife/tensorflow/local/lib/python2.7/site-packages/pandas/core/frame.py", line 2688, in getitem
return self._getitem_column(key)
File "/home/elife/tensorflow/local/lib/python2.7/site-packages/pandas/core/frame.py", line 2695, in _getitem_column
return self._get_item_cache(key)
File "/home/elife/tensorflow/local/lib/python2.7/site-packages/pandas/core/generic.py", line 2489, in _get_item_cache
values = self._data.get(item)
File "/home/elife/tensorflow/local/lib/python2.7/site-packages/pandas/core/internals.py", line 4115, in get
loc = self.items.get_loc(item)
File "/home/elife/tensorflow/local/lib/python2.7/site-packages/pandas/core/indexes/base.py", line 3080, in get_loc
return self._engine.get_loc(self._maybe_cast_indexer(key))
File "pandas/_libs/index.pyx", line 140, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index.pyx", line 162, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 1492, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 1500, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'S783'
(tensorflow) (base) elife@ubuntu:~/work/Trading/Stock-market-forecasting$

ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type float).

Hi,
when I tried to porting this project into python notebook for Google colab,
I subjected to this issue below:

1993

(251416, 244) (121079, 244) 97.39196372032166
Model: "model_2"


Layer (type) Output Shape Param #

input_3 (InputLayer) [(None, 240, 1)] 0


lstm_2 (LSTM) (None, 25) 2700


dropout (Dropout) (None, 25) 0


dense_2 (Dense) (None, 2) 52

Total params: 2,752
Trainable params: 2,752
Non-trainable params: 0


WARNING:tensorflow:period argument is deprecated. Please use save_freq to specify the frequency in number of batches seen.

ValueError Traceback (most recent call last)
in ()
253 print(train_data.shape,test_data.shape,time.time()-start)
254
--> 255 model,predictions = trainer(train_data,test_data)
256 returns = simulate(test_data,predictions)
257 returns.to_csv(result_folder+'/avg_daily_rets-'+str(test_year)+'.csv')

12 frames
in trainer(train_data, test_data, model_type)
148 validation_split=0.2,
149 callbacks=callbacks,
--> 150 batch_size=512
151 )
152

/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py in _method_wrapper(self, *args, **kwargs)
64 def _method_wrapper(self, *args, **kwargs):
65 if not self._in_multi_worker_mode(): # pylint: disable=protected-access
---> 66 return method(self, *args, **kwargs)
67
68 # Running inside run_distribute_coordinator already.

/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_batch_size, validation_freq, max_queue_size, workers, use_multiprocessing)
795 data_adapter.train_validation_split((x, y, sample_weight),
796 validation_split=validation_split,
--> 797 shuffle=False))
798
799 with self.distribute_strategy.scope(), \

/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/data_adapter.py in train_validation_split(arrays, validation_split, shuffle)
1336
1337 train_arrays = nest.map_structure(
-> 1338 functools.partial(_split, indices=train_indices), arrays)
1339 val_arrays = nest.map_structure(
1340 functools.partial(_split, indices=val_indices), arrays)

/usr/local/lib/python3.6/dist-packages/tensorflow/python/util/nest.py in map_structure(func, *structure, **kwargs)
615
616 return pack_sequence_as(
--> 617 structure[0], [func(*x) for x in entries],
618 expand_composites=expand_composites)
619

/usr/local/lib/python3.6/dist-packages/tensorflow/python/util/nest.py in (.0)
615
616 return pack_sequence_as(
--> 617 structure[0], [func(*x) for x in entries],
618 expand_composites=expand_composites)
619

/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/data_adapter.py in _split(t, indices)
1332 if t is None:
1333 return t
-> 1334 t = ops.convert_to_tensor_v2(t)
1335 return array_ops.gather_v2(t, indices)
1336

/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py in convert_to_tensor_v2(value, dtype, dtype_hint, name)
1281 name=name,
1282 preferred_dtype=dtype_hint,
-> 1283 as_ref=False)
1284
1285

/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py in convert_to_tensor(value, dtype, name, as_ref, preferred_dtype, dtype_hint, ctx, accepted_result_types)
1339
1340 if ret is None:
-> 1341 ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
1342
1343 if ret is NotImplemented:

/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/tensor_conversion_registry.py in _default_conversion_function(failed resolving arguments)
50 def _default_conversion_function(value, dtype, name, as_ref):
51 del as_ref # Unused.
---> 52 return constant_op.constant(value, dtype, name=name)
53
54

/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/constant_op.py in constant(value, dtype, shape, name)
260 """
261 return _constant_impl(value, dtype, shape, name, verify_shape=False,
--> 262 allow_broadcast=True)
263
264

/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/constant_op.py in _constant_impl(value, dtype, shape, name, verify_shape, allow_broadcast)
268 ctx = context.context()
269 if ctx.executing_eagerly():
--> 270 t = convert_to_eager_tensor(value, ctx, dtype)
271 if shape is None:
272 return t

/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/constant_op.py in convert_to_eager_tensor(value, ctx, dtype)
94 dtype = dtypes.as_dtype(dtype).as_datatype_enum
95 ctx.ensure_initialized()
---> 96 return ops.EagerTensor(value, ctx.device_name, dtype)
97
98

ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type float).

tensorflow.python.framework.errors_impl.InvalidArgumentError: No OpKernel was registered to support Op 'CudnnRNN'

My environment
Windows 10
conda environment with scikit-learn==0.20.4 & tensorflow==1.14.0

python -Wignore "Intraday-240,1-LSTM.py"

WARNING:tensorflow:From Intraday-240,1-LSTM.py:11: The name tf.keras.layers.CuDNNLSTM is deprecated. Please use tf.compat.v1.keras.layers.CuDNNLSTM instead.


1993

(251416, 244) (121079, 244) 109.14551615715027
WARNING:tensorflow:From C:\ProgramData\Anaconda3\envs\myenv1\lib\site-packages\tensorflow\python\ops\init_ops.py:1251: calling VarianceScaling.init (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version.
Instructions for updating:
Call initializer instance with the dtype argument instead of passing it to the constructor
Model: "model"


Layer (type) Output Shape Param #

input_1 (InputLayer) [(None, 240, 1)] 0


cu_dnnlstm (CuDNNLSTM) (None, 25) 2800


dropout (Dropout) (None, 25) 0


dense (Dense) (None, 2) 52

Total params: 2,852
Trainable params: 2,852
Non-trainable params: 0


WARNING:tensorflow:period argument is deprecated. Please use save_freq to specify the frequency in number of samples seen.
Train on 201132 samples, validate on 50284 samples
2021-09-02 12:44:05.181180: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\myenv1\lib\site-packages\tensorflow\python\client\session.py", line 1356, in _do_call
return fn(*args)
File "C:\ProgramData\Anaconda3\envs\myenv1\lib\site-packages\tensorflow\python\client\session.py", line 1339, in _run_fn
self._extend_graph()
File "C:\ProgramData\Anaconda3\envs\myenv1\lib\site-packages\tensorflow\python\client\session.py", line 1374, in _extend_graph
tf_session.ExtendSession(self._session)
tensorflow.python.framework.errors_impl.InvalidArgumentError: No OpKernel was registered to support Op 'CudnnRNN' used by {{node cu_dnnlstm/CudnnRNN}}with these attrs: [seed=0, dropout=0, T=DT_FLOAT, input_mode="linear_input", direction="unidirectional", rnn_mode="lstm", seed2=0, is_training=true]
Registered devices: [CPU]
Registered kernels:

     [[cu_dnnlstm/CudnnRNN]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "Intraday-240,1-LSTM.py", line 194, in
model,predictions = trainer(train_data,test_data)
File "Intraday-240,1-LSTM.py", line 89, in trainer
batch_size=512
File "C:\ProgramData\Anaconda3\envs\myenv1\lib\site-packages\tensorflow\python\keras\engine\training.py", line 780, in fit
steps_name='steps_per_epoch')
File "C:\ProgramData\Anaconda3\envs\myenv1\lib\site-packages\tensorflow\python\keras\engine\training_arrays.py", line 250, in model_iteration
model.reset_metrics()
File "C:\ProgramData\Anaconda3\envs\myenv1\lib\site-packages\tensorflow\python\keras\engine\training.py", line 1084, in reset_metrics
m.reset_states()
File "C:\ProgramData\Anaconda3\envs\myenv1\lib\site-packages\tensorflow\python\keras\metrics.py", line 199, in reset_states
K.batch_set_value([(v, 0) for v in self.variables])
File "C:\ProgramData\Anaconda3\envs\myenv1\lib\site-packages\tensorflow\python\keras\backend.py", line 3071, in batch_set_value
get_session().run(assign_ops, feed_dict=feed_dict)
File "C:\ProgramData\Anaconda3\envs\myenv1\lib\site-packages\tensorflow\python\keras\backend.py", line 462, in get_session
_initialize_variables(session)
File "C:\ProgramData\Anaconda3\envs\myenv1\lib\site-packages\tensorflow\python\keras\backend.py", line 879, in _initialize_variables
[variables_module.is_variable_initialized(v) for v in candidate_vars])
File "C:\ProgramData\Anaconda3\envs\myenv1\lib\site-packages\tensorflow\python\client\session.py", line 950, in run
run_metadata_ptr)
File "C:\ProgramData\Anaconda3\envs\myenv1\lib\site-packages\tensorflow\python\client\session.py", line 1173, in _run
feed_dict_tensor, options, run_metadata)
File "C:\ProgramData\Anaconda3\envs\myenv1\lib\site-packages\tensorflow\python\client\session.py", line 1350, in _do_run
run_metadata)
File "C:\ProgramData\Anaconda3\envs\myenv1\lib\site-packages\tensorflow\python\client\session.py", line 1370, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: No OpKernel was registered to support Op 'CudnnRNN' used by node cu_dnnlstm/CudnnRNN (defined at Intraday-240,1-LSTM.py:44) with these attrs: [seed=0, dropout=0, T=DT_FLOAT, input_mode="linear_input", direction="unidirectional", rnn_mode="lstm", seed2=0, is_training=true]
Registered devices: [CPU]

Registered kernels:

     [[cu_dnnlstm/CudnnRNN]]

安装版本

请问都安装了那些版本的库啊?可以标注一下吗

Hi Newbie With Tech Background

This looks so amazing. I have gotten it to run with the test data but something seems to be missing that I can't figure out. If it's not a huge pain, Is it possible to walk me through how to use this on the SPY ETF?

Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 22069 MB memory) -> physical GPU (device: 0, name: NVIDIA GeForce RTX 3090, pci bus id: 0000:01:00.0, compute capability: 8.6)
Epoch 1/1000
2021-09-12 13:34:29.486149: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_100.dll
2021-09-12 13:35:53.619664: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2021-09-12 13:52:40.007267: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at cudnn_rnn_ops.cc:1500 : Internal: No algorithm worked!
Traceback (most recent call last):
File "NextDay-240,1-LSTM.py", line 197, in
predictions = trainer(train_data,test_data,model_type)
File "NextDay-240,1-LSTM.py", line 94, in trainer
batch_size=512
File "C:\Users\George\anaconda3\envs\predict\lib\site-packages\tensorflow_core\python\keras\engine\training.py", line 727, in fit
use_multiprocessing=use_multiprocessing)
File "C:\Users\George\anaconda3\envs\predict\lib\site-packages\tensorflow_core\python\keras\engine\training_arrays.py", line 675, in fit
steps_name='steps_per_epoch')
File "C:\Users\George\anaconda3\envs\predict\lib\site-packages\tensorflow_core\python\keras\engine\training_arrays.py", line 394, in model_iteration
batch_outs = f(ins_batch)
File "C:\Users\George\anaconda3\envs\predict\lib\site-packages\tensorflow_core\python\keras\backend.py", line 3476, in call
run_metadata=self.run_metadata)
File "C:\Users\George\anaconda3\envs\predict\lib\site-packages\tensorflow_core\python\client\session.py", line 1472, in call
run_metadata_ptr)
tensorflow.python.framework.errors_impl.InternalError: 2 root error(s) found.
(0) Internal: No algorithm worked!
[[{{node cu_dnnlstm/CudnnRNNV2}}]]
[[loss/mul/_61]]
(1) Internal: No algorithm worked!
[[{{node cu_dnnlstm/CudnnRNNV2}}]]
0 successful operations.
0 derived errors ignored.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.