Downloads · 30 days
3
10% of all-time downloads
Shoriful025/crypto-trend-predictor-lstm-v1
crypto-trend-predictor-lstm-v1 is a machine learning model from Shoriful025. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
The crypto-trend-predictor-lstm-v1 is a sequential recurrent neural network model designed for time-series forecasting of cryptocurrency prices. Specifically, this model is trained to predict the normalized closing pr…
Downloads · 30 days
3
10% of all-time downloads
All-time downloads
30
Public
Repo size
—
Likes
0
Public
Click a slice to open those files.
.md4.1 KB · 68%
From the Hugging Face model README
The crypto-trend-predictor-lstm-v1 is a sequential recurrent neural network model designed for time-series forecasting of cryptocurrency prices. Specifically, this model is trained to predict the normalized closing price of Bitcoin (BTC) one day in advance, using historical financial indicators.
The core of the model is a Stacked Long Short-Term Memory (LSTM) network, which is highly effective for processing sequential data and capturing long-range dependencies in time series.
hidden_size of 128.This example shows the forward pass setup, assuming the model weights and data pre-processing are handled externally.
import torch
import torch.nn as nn
# Model parameters (matches config.json)
INPUT_SIZE = 7
HIDDEN_SIZE = 128
NUM_LAYERS = 3
DROPOUT = 0.3
SEQ_LENGTH = 30 # Time steps (30 days)
class SequentialLSTMModel(nn.Module):
def __init__(self, input_size, hidden_size, num_layers, dropout):
super().__init__()
self.lstm = nn.LSTM(input_size, hidden_size, num_layers,
batch_first=True, dropout=dropout)
self.linear = nn.Linear(hidden_size, 1)
def forward(self, x):
# x shape: (Batch_Size, Seq_Length, Input_Size)
lstm_out, _ = self.lstm(x)
# We only care about the last time step's output
last_step_output = lstm_out[:, -1, :]
prediction = self.linear(last_step_output)
return prediction
# Load weights and instantiate (Conceptual)
# model = SequentialLSTMModel(INPUT_SIZE, HIDDEN_SIZE, NUM_LAYERS, DROPOUT)
# model.load_state_dict(torch.load("pytorch_model.bin"))
# model.eval()
# Dummy input data (Batch_Size=1, Seq_Length=30, Input_Size=7)
# This represents 30 days of the 7 features
dummy_input = torch.randn(1, SEQ_LENGTH, INPUT_SIZE)
# with torch.no_grad():
# normalized_prediction = model(dummy_input)
# print(f"Normalized Price Prediction: {normalized_prediction.item()}")
# (Must be de-normalized externally)