Downloads · 30 days
7
12% of all-time downloads
Tasfiya025/Financial-Time-Series
Financial-Time-Series is a machine learning model from Tasfiya025. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
CryptoTS-Transformer-Forecast-7D is a purpose-built Transformer model designed for financial time series forecasting, specifically predicting the next 7 days of the closing price for major cryptocurrencies (e.g., BTC,…
Downloads · 30 days
7
12% of all-time downloads
All-time downloads
59
Public
Repo size
—
Likes
0
Public
Click a slice to open those files.
.md3.6 KB · 65%
From the Hugging Face model README
CryptoTS-Transformer-Forecast-7D is a purpose-built Transformer model designed for financial time series forecasting, specifically predicting the next 7 days of the closing price for major cryptocurrencies (e.g., BTC, ETH).
Unlike traditional RNNs, this architecture leverages the attention mechanism to capture long-range dependencies and complex correlations across multiple technical indicators, leading to more robust sequence-to-sequence predictions.
The model is a custom encoder-decoder Transformer architecture:
seq_len): 60 time steps (representing 60 days of historical data).output_len): 7 time steps (the 7 days being predicted).input_size): 12 features, including OHLCV data and 7 key technical indicators (MACD, RSI, various moving averages and Bollinger Bands).This example assumes a pre-processed input tensor input_data (60 days of 12 features) scaled using a standard scaler.
import torch
import torch.nn as nn
from transformers import AutoModel
# NOTE: This model uses a custom class not available in standard transformers,
# but can be loaded via a custom class or registered in AutoModel.
# For demonstration, we assume it's loaded as a generic AutoModel.
model_name = "Your-HF-Username/CryptoTS-Transformer-Forecast-7D"
model = AutoModel.from_pretrained(model_name)
model.eval()
# Dummy input data: (Batch_Size, Sequence_Length, Input_Features) -> (1, 60, 12)
# In a real scenario, this would be 60 days of OHLCV + 7 Indicators, scaled.
input_data = torch.randn(1, model.config.seq_len, model.config.input_size)
# Make prediction
with torch.no_grad():
# Output shape will be (Batch_Size, Output_Length, 1) or (1, 7, 1) for the predicted Close price
prediction = model(input_data)
# Convert predicted prices back to their original scale using the inverse transform
# predicted_prices_7d = scaler.inverse_transform(prediction.cpu().numpy())
print("Input shape (60 days, 12 features):", input_data.shape)
print("Predicted output shape (7 days, 1 feature/price):", prediction.shape)
print("Predicted 7-day normalized closing prices:\n", prediction.squeeze().numpy())