Tasfiya025's picture
Create README.md
3b48be3 verified
# CryptoTrendPredictor_LSTM
## 📈 Overview
This repository hosts a custom **Long Short-Term Memory (LSTM)** recurrent neural network designed for **single-step time-series prediction** of cryptocurrency prices. Specifically, this model is trained to predict the **normalized closing price of Bitcoin (BTC)** for the next day, utilizing a diverse set of technical indicators and on-chain metrics.
## 🧠 Model Architecture
The model implements a stacked LSTM architecture, which is highly effective for capturing long-term dependencies in sequential data like price time series.
* **Architecture:** Stacked LSTM (3 layers) with a final Dense layer for regression.
* **Input Features (`input_size=10`):** 10 features including price, volume, technical indicators (RSI, MACD), market correlation, and external factors (Google Trends, Social Media Sentiment).
* **Sequence Length (`sequence_length=60`):** The model takes the past **60 time steps (days)** of feature data as input to make one prediction.
* **Hidden State Size (`hidden_size=128`):** 128 units per LSTM layer.
* **Output:** A single floating-point value representing the normalized predicted closing price for the next time step.
* **Loss Function:** Mean Squared Error (MSE).
## 💡 Intended Use
* **Price Forecasting:** Providing a **probabilistic forecast** of the next-day price movement for risk assessment.
* **Signal Generation:** Generating buy/sell/hold signals when the predicted value crosses predefined thresholds.
* **Comparative Analysis:** Benchmarking against simpler linear or technical analysis models.
### Data Requirements for Inference
The model expects a numpy array/tensor of shape `(batch_size, sequence_length, input_size)`. The input features **must** be normalized using the same min/max scaling applied during training.
### How to use (Conceptual Example)
```python
import numpy as np
# Assuming the model is loaded from a framework like PyTorch or TensorFlow
# and inference data is ready and pre-processed.
# Replace with actual data (60 days of 10 features, normalized)
input_data = np.random.rand(1, 60, 10).astype(np.float32)
# prediction = model(input_data)
# print(f"Normalized Prediction: {prediction.item()}")
# Inverse transform the prediction to get the actual price forecast
# forecasted_price = scaler.inverse_transform(prediction)
# print(f"Forecasted BTC Price: ${forecasted_price.item():.2f}")