Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hayatiyrtgl/cryptocurrency_time_series_rnn

Python script for training a Simple RNN model on cryptocurrency price data to predict future prices, including data exploration and evaluation
https://github.com/hayatiyrtgl/cryptocurrency_time_series_rnn

data-analysis data-science data-visualization keras pandas pandas-python prediction predictive-modeling python python-script rnn rnn-tensorflow tensorflow time-series time-series-analysis

Last synced: 3 days ago
JSON representation

Python script for training a Simple RNN model on cryptocurrency price data to predict future prices, including data exploration and evaluation

Awesome Lists containing this project

README

        

This code is a Python script for building and training a Simple Recurrent Neural Network (RNN) using Keras to predict cryptocurrency prices. Here's a breakdown of what each section does:

1. **Importing Libraries**: This section imports necessary libraries such as pandas, numpy, scikit-learn, keras, and matplotlib.

2. **Reading Data**: Reads cryptocurrency price data from a CSV file.

3. **Data Exploration**:
- Checks for missing values.
- Displays data types and descriptive statistics.
- Visualizes data using scatter plots and a heatmap of correlations between features.

4. **Data Preprocessing**:
- Converts the timestamp column to datetime format.
- Sets the timestamp column as the index.

5. **Train-Test Split**:
- Manually splits the data into training and testing sets.
- Defines a function `train_test_split` to create input-output pairs for training the model.

6. **Creating the RNN Model**:
- Uses Keras Sequential API to define an RNN model.
- The model consists of an Input layer, a SimpleRNN layer with 60 units and 'tanh' activation function, and a Dense output layer.
- Compiles the model using mean squared error loss and Adam optimizer, with R2Score as a metric.

7. **Training the Model**:
- Fits the model to the training data with early stopping and model checkpointing callbacks.
- Validates the model on a validation split of the training data.

8. **Evaluation**:
- Predicts cryptocurrency prices using the trained model.
- Plots the predicted prices against the true prices for evaluation.

Overall, this script demonstrates a basic workflow for building and training a recurrent neural network for cryptocurrency price prediction using historical data.