Using multidimensional LSTM neural networks to create a forecast for Bitcoin price

Overview

Multidimensional LSTM BitCoin Time Series

Using multidimensional LSTM neural networks to create a forecast for Bitcoin price.

For notes around this code and a general explenation for the theory please see my original article HERE

Comments
  • TypeError: Cannot interpret feed_dict key as Tensor: Tensor Tensor(

    TypeError: Cannot interpret feed_dict key as Tensor: Tensor Tensor("lstm_1_input:0", shape=(?, ?, 4), dtype=float32) is not an element of this graph.

    Fresh clone, data/bitcoin.csv unzipped, Keras(2.0.6) TensorFlow(1.2.1) Python(3.6.2) (full pip freeze).

    [Edit] Also tried on Python 2.7, same error. (full pip freeze)

    Full error:

    (btc3) lefnire@lefnire-ubuntu:~/Sites/btc/github/Multidimensional-LSTM-BitCoin-Time-Series$ python run.py 
    Using TensorFlow backend.
    > Creating x & y data files...
    > Clean datasets created in file `data/clean_data.h5.h5`
    > Generating clean data from: data/clean_data.h5 with batch_size: 100
    > Clean data has 180610 data rows. Training on 144488 rows with 722 steps-per-epoch
    > Compilation Time :  0.010142087936401367
    > Testing model on 36122 data rows with 361 steps
    2017-08-09 17:15:15.447882: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
    2017-08-09 17:15:15.447905: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
    2017-08-09 17:15:15.447909: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
    2017-08-09 17:15:15.447913: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
    2017-08-09 17:15:15.447917: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
    2017-08-09 17:15:15.563391: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:893] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
    2017-08-09 17:15:15.563705: I tensorflow/core/common_runtime/gpu/gpu_device.cc:940] Found device 0 with properties: 
    name: GeForce GTX 1080 Ti
    major: 6 minor: 1 memoryClockRate (GHz) 1.582
    pciBusID 0000:01:00.0
    Total memory: 10.90GiB
    Free memory: 10.02GiB
    2017-08-09 17:15:15.563716: I tensorflow/core/common_runtime/gpu/gpu_device.cc:961] DMA: 0 
    2017-08-09 17:15:15.563719: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 0:   Y 
    2017-08-09 17:15:15.563724: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1030] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:01:00.0)
    > Compilation Time :  0.009964227676391602
    Epoch 1/2
    Exception in thread Thread-1:
    Traceback (most recent call last):
      File "/home/lefnire/anaconda3/envs/btc3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 942, in _run
        allow_operation=False)
      File "/home/lefnire/anaconda3/envs/btc3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2584, in as_graph_element
        return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
      File "/home/lefnire/anaconda3/envs/btc3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2663, in _as_graph_element_locked
        raise ValueError("Tensor %s is not an element of this graph." % obj)
    ValueError: Tensor Tensor("lstm_1_input:0", shape=(?, ?, 4), dtype=float32) is not an element of this graph.
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/lefnire/anaconda3/envs/btc3/lib/python3.6/threading.py", line 916, in _bootstrap_inner
        self.run()
      File "/home/lefnire/anaconda3/envs/btc3/lib/python3.6/threading.py", line 864, in run
        self._target(*self._args, **self._kwargs)
      File "run.py", line 64, in fit_model_threaded
        epochs=configs['model']['epochs']
      File "/home/lefnire/anaconda3/envs/btc3/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 87, in wrapper
        return func(*args, **kwargs)
      File "/home/lefnire/anaconda3/envs/btc3/lib/python3.6/site-packages/keras/models.py", line 1117, in fit_generator
        initial_epoch=initial_epoch)
      File "/home/lefnire/anaconda3/envs/btc3/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 87, in wrapper
        return func(*args, **kwargs)
      File "/home/lefnire/anaconda3/envs/btc3/lib/python3.6/site-packages/keras/engine/training.py", line 1840, in fit_generator
        class_weight=class_weight)
      File "/home/lefnire/anaconda3/envs/btc3/lib/python3.6/site-packages/keras/engine/training.py", line 1565, in train_on_batch
        outputs = self.train_function(ins)
      File "/home/lefnire/anaconda3/envs/btc3/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 2268, in __call__
        **self.session_kwargs)
      File "/home/lefnire/anaconda3/envs/btc3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 789, in run
        run_metadata_ptr)
      File "/home/lefnire/anaconda3/envs/btc3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 945, in _run
        + e.args[0])
    TypeError: Cannot interpret feed_dict key as Tensor: Tensor Tensor("lstm_1_input:0", shape=(?, ?, 4), dtype=float32) is not an element of this graph.
    

    I realize you're likely not keen on supporting a blog-post's code-demo, but just in case someone has top-of-the-dome.

    opened by lefnire 19
  • When I return the values to original scale the result is very poor

    When I return the values to original scale the result is very poor

    Figure_6 As you can see I scaled back everything to the original. You can also notice the SP500 trend is usually upward rather the scaled graph predicted many down trends.

    opened by Harkishan-99 0
  • Tensor type error

    Tensor type error

    Hi,

    When I try to train the LSTM I get the following error:

    TypeError: Cannot interpret feed_dict key as Tensor: Tensor Tensor("lstm_1_input:0", shape=(?, ?, 4), dtype=float32) is not an element of this graph.

    Any suggestions? Thanks!

    opened by Huub79 0
  • how to understand your Standardise method - dataframe div first row

    how to understand your Standardise method - dataframe div first row

    Dears,

    I am confused about the standardise method in the code -

        def zero_base_standardise(self, data, abs_base=pd.DataFrame()):
            """Standardise dataframe to be zero based percentage returns from i=0"""
            if(abs_base.empty): abs_base = data.iloc[0]
            data_standardised = (data/abs_base)-1
            return (abs_base, data_standardised)
    

    My understanding about the standarise is -

    (x - mean) / standard_deviation
    mean = sum(x) / count(x)
    standard_deviation = sqrt( sum( (x - mean)^2 ) / count(x))
    

    I think (data/abs_base)-1 should be far from standardised values, could you please kindly let me know if I misunderstood anything? Thank you very much!

    opened by elulue 0
  • I coppied and pasted code from multidementional forcasting into a spreadsheet for the bitcoin multi dimentional forcasting software to run on 300 lines

    I coppied and pasted code from multidementional forcasting into a spreadsheet for the bitcoin multi dimentional forcasting software to run on 300 lines

    I coppied and pasted code from multidementional forcasting into a spreadsheet for the bitcoin multi dimentional forcasting software to run on 300 lines.

    I am not shure why the data line plotted only and the predicted line was behind it or invisible or not plotted.

    I pasted it for all the columns the 2 columns of data.

    here is where I got my data set from https://www.itl.nist.gov/div898/handbook/pmc/section4/pmc451.htm

    opened by josheeg 0
Owner
Jakob Aungiers
Head of Systematic Market Making at a global HFT firm // Expert Adviser & Consultant in AI // Skydiver // Surfer // Adventurer
Jakob Aungiers
Time-series-deep-learning - Developing Deep learning LSTM, BiLSTM models, and NeuralProphet for multi-step time-series forecasting of stock price.

Stock Price Prediction Using Deep Learning Univariate Time Series Predicting stock price using historical data of a company using Neural networks for

Abdultawwab Safarji 7 Nov 27, 2022
Price-Prediction-For-a-Dream-Home - A machine learning based linear regression trained model for house price prediction.

Price-Prediction-For-a-Dream-Home ROADMAP TO THIS LINEAR REGRESSION BASED HOUSE PRICE PREDICTION PREDICTION MODEL Import all the dependencies of the p

DIKSHA DESWAL 1 Dec 29, 2021
Gradient-free global optimization algorithm for multidimensional functions based on the low rank tensor train format

ttopt Description Gradient-free global optimization algorithm for multidimensional functions based on the low rank tensor train (TT) format and maximu

null 5 May 23, 2022
LSTM Neural Networks for Spectroscopic Studies of Type Ia Supernovae

Package Description The difficulties in acquiring spectroscopic data have been a major challenge for supernova surveys. snlstm is developed to provide

null 7 Oct 11, 2022
Neural-fractal - Create Fractals Using Complex-Valued Neural Networks!

Neural Fractal Create Fractals Using Complex-Valued Neural Networks! Home Page Features Define Dynamical Systems Using Complex-Valued Neural Networks

Amirabbas Asadi 10 Dec 17, 2022
A PaddlePaddle implementation of STGCN with a few modifications in the model architecture in order to forecast traffic jam.

About This repository contains the code of a PaddlePaddle implementation of STGCN based on the paper Spatio-Temporal Graph Convolutional Networks: A D

Tianjian Li 1 Jan 11, 2022
OHLC Average Prediction of Apple Inc. Using LSTM Recurrent Neural Network

Stock Price Prediction of Apple Inc. Using Recurrent Neural Network OHLC Average Prediction of Apple Inc. Using LSTM Recurrent Neural Network Dataset:

Nouroz Rahman 410 Jan 5, 2023
a reccurrent neural netowrk that when trained on a peice of text and fed a starting prompt will write its on 250 character text using LSTM layers

RNN-Playwrite a reccurrent neural netowrk that when trained on a peice of text and fed a starting prompt will write its on 250 character text using LS

Arno Barton 1 Oct 29, 2021
PyTorch implementation of the Quasi-Recurrent Neural Network - up to 16 times faster than NVIDIA's cuDNN LSTM

Quasi-Recurrent Neural Network (QRNN) for PyTorch Updated to support multi-GPU environments via DataParallel - see the the multigpu_dataparallel.py ex

Salesforce 1.3k Dec 28, 2022
Using a Seq2Seq RNN architecture via TensorFlow to predict future Bitcoin prices

Recurrent Bitcoin Network A Data Science Thesis Project About This repository contains the source code for implementing Bitcoin price prediciton using

Frizu 6 Sep 8, 2022
Complex-Valued Neural Networks (CVNN)Complex-Valued Neural Networks (CVNN)

Complex-Valued Neural Networks (CVNN) Done by @NEGU93 - J. Agustin Barrachina Using this library, the only difference with a Tensorflow code is that y

youceF 1 Nov 12, 2021
Neural network for stock price prediction

neural_network_for_stock_price_prediction Neural networks for stock price predic

null 2 Feb 4, 2022
Using LSTM write Tang poetry

本教程将通过一个示例对LSTM进行介绍。通过搭建训练LSTM网络,我们将训练一个模型来生成唐诗。本文将对该实现进行详尽的解释,并阐明此模型的工作方式和原因。并不需要过多专业知识,但是可能需要新手花一些时间来理解的模型训练的实际情况。为了节省时间,请尽量选择GPU进行训练。

null 56 Dec 15, 2022
A resource for learning about deep learning techniques from regression to LSTM and Reinforcement Learning using financial data and the fitness functions of algorithmic trading

A tour through tensorflow with financial data I present several models ranging in complexity from simple regression to LSTM and policy networks. The s

null 195 Dec 7, 2022
Forecasting directional movements of stock prices for intraday trading using LSTM and random forest

Forecasting directional movements of stock-prices for intraday trading using LSTM and random-forest https://arxiv.org/abs/2004.10178 Pushpendu Ghosh,

Pushpendu Ghosh 270 Dec 24, 2022
Deep learning based hand gesture recognition using LSTM and MediaPipie.

Hand Gesture Recognition Deep learning based hand gesture recognition using LSTM and MediaPipie. Demo video using PingPong Robot Files Pretrained mode

Brad 24 Nov 11, 2022
Sign Language is detected in realtime using video sequences. Our approach involves MediaPipe Holistic for keypoints extraction and LSTM Model for prediction.

RealTime Sign Language Detection using Action Recognition Approach Real-Time Sign Language is commonly predicted using models whose architecture consi

Rishikesh S 15 Aug 20, 2022
Using LSTM to detect spoofing attacks in an Air-Ground network

Using LSTM to detect spoofing attacks in an Air-Ground network Specifications IDE: Spider Packages: Tensorflow 2.1.0 Keras NumPy Scikit-learn Matplotl

Tiep M. H. 1 Nov 20, 2021
Image Captioning using CNN ,LSTM and Attention

Image Captioning using CNN ,LSTM and Attention This is a deeplearning model which tries to summarize an image into a text . Installation Install this

ASUTOSH GHANTO 1 Dec 16, 2021