Crypto Trading

Cryptocurrency-predicting RNN Model – Deep Learning w/ Python, TensorFlow and Keras p.11

Cryptocurrency-predicting RNN Model – Deep Learning w/ Python, TensorFlow and Keras p.11

Cryptocurrency-predicting RNN Model – Deep Learning w/ Python, TensorFlow and Keras p.11

Welcome to the next tutorial covering deep learning with Python, Tensorflow, and Keras. We’ve been working on a cryptocurrency price movement prediction recurrent neural network, focusing mainly on the pre-processing that we’ve got to do. In this tutorial, we’re going to be finishing up by building our model and training it.

Text tutorials and sample code: https://pythonprogramming.net/crypto-rnn-model-deep-learning-python-tensorflow-keras/

Discord: https://discord.gg/sentdex
Support the content: https://pythonprogramming.net/support-donate/
Twitter: https://twitter.com/sentdex
Facebook: https://www.facebook.com/pythonprogramming.net/
Twitch: https://www.twitch.tv/sentdex
G+: https://plus.google.com/+sentdex

Video for Crypto Trading Machine Learning
Crypto Trading Machine Learning youtube video content

12 Comments

  1. I got this error when running:
    ValueError: Failed to find data adapter that can handle input: <class 'numpy.ndarray'>, (<class 'list'> containing values of types {"<class 'numpy.float64'>"})

    When I tried np.assarray on the train and validation variables it gave me the following error:
    W tensorflow/core/framework/op_kernel.cc:1733] INVALID_ARGUMENT: required broadcastable shapes

    Note: Code is exact same as sample code in video

    Edit: I found the fix! First have to put the following before your fit() command:

    train_x = np.asarray(train_x)

    train_y = np.asarray(train_y)

    validation_x = np.asarray(validation_x)

    validation_y = np.asarray(validation_y)

    then you have to replace all instances of val_acc in your code with val_accuracy (use control F to do this)

    then just make sure all your code and layer properties match his and it worked for me!

  2. Great tutorial! Thank u! Im quite new to Deep Learning. I learnt that this model can do analysis of accuracy and losses, But i dont know how to put this to use? Is there anyway to know the future price using this model to know if the price will increase or not if we give a dataset?

  3. Hello, please help someone. I am still getting this error when i try to run this code: raise ValueError(

    ValueError: Failed to find data adapter that can handle input: <class 'numpy.ndarray'>, (<class 'list'> containing values of types {"<class 'numpy.float64'>"})ValueError: Failed to find data adapter that can handle input: <class 'numpy.ndarray'>, (<class 'list'> containing values of types {"<class 'numpy.float64'>"}) How to solve it? Thanks

  4. Hi Thanks for sharing,
    I have an errors:
    2021-12-15 12:56:20.767734: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found

    2021-12-15 12:56:20.773088: W tensorflow/stream_executor/cuda/cuda_driver.cc:269] failed call to cuInit: UNKNOWN ERROR (303)

    2021-12-15 12:56:20.780483: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-D470840

    2021-12-15 12:56:20.784089: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-D470840

    2021-12-15 12:56:20.786685: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2

    To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.

    C:UsersUserKtrAppDataLocalProgramsPythonPython37libsite-packageskerasoptimizer_v2adam.py:105: UserWarning: The `lr` argument is deprecated, use `learning_rate` instead.

    super(Adam, self).__init__(name, **kwargs)

    Traceback (most recent call last):

    File "trading.py", line 165, in <module>

    callbacks=[tensorboard, checkpoint],

    File "C:UsersUserKtrAppDataLocalProgramsPythonPython37libsite-packageskerasutilstraceback_utils.py", line 67, in error_handler

    raise e.with_traceback(filtered_tb) from None

    File "C:UsersUserKtrAppDataLocalProgramsPythonPython37libsite-packageskerasenginedata_adapter.py", line 991, in select_data_adapter

    _type_name(x), _type_name(y)))

    ValueError: Failed to find data adapter that can handle input: <class 'numpy.ndarray'>, (<class 'list'> containing values of types {"<class 'numpy.float64'>"})

    Thanks for help

  5. are you throwing away these cups after every video? cause they're not seen again

  6. Nicely done, Sentdex. One of the issues with using price data that generally increases is that the model can learn to always guess "buy" and be around 55-56% correct due to the innate bias of the data. I.e. 55-56% of the time the price is increasing. So for the sake of evaluating an investment model, you need to first establish the percent of days where the price is increasing, and set that as your base. Any improvement above that is better than just buying and "hodling". OR you can prune your data by training it on an equal amount of buy/sell periods. With an LSTM, though, this would be a bit more tricky. This can work for a Transformer or Conv-based model.

  7. when i run model.predict it retunrs a list of shape (1, 2) with the same 2 decimal numbers 0.49 and 0.50. Am I missing a step in the process of obtaining the prediction? np.argmax(prediction) always returns 1

  8. After you replace the return method on preprocess_df to "return np.array(X).astype("float32"), np.array(y)".
    You can no longer use .count() on the f strings so replace them to this:
    “`print(f"train data: {len(train_x)} validation: {len(validation_x)}")

    print(f"Dont buys: {np.count_nonzero(train_y == 1.0, axis=0)}, buys: {np.count_nonzero(train_y == 0.0, axis=0)}")

    print(f"VALIDATION Dont buys: {np.count_nonzero(validation_x == 1.0, axis=0)}, buys: {np.count_nonzero(validation_y == 0.0, axis=0)}")“`

Leave a Reply

Your email address will not be published.