lstm-petr4-stock-prediction
99
license:mit
by
guifav
Other
OTHER
New
99 downloads
Early-stage
Edge AI:
Mobile
Laptop
Server
Unknown
Mobile
Laptop
Server
Quick Summary
AI model with specialized capabilities.
Code Examples
Metricas (Conjunto de Teste)pythonpytorch
import torch
import joblib
import json
import numpy as np
# Carregar artefatos
config = json.load(open("config.json"))
scaler = joblib.load("scaler.joblib")
# Reconstruir modelo
from model import LSTMModel
model = LSTMModel(
input_size=config["model"]["input_size"],
hidden_size=config["model"]["hidden_size"],
num_layers=config["model"]["num_layers"],
dropout=config["model"]["dropout"]
)
model.load_state_dict(torch.load("lstm_model.pth", map_location="cpu", weights_only=True))
model.eval()
# Fazer previsao (com 60 precos de fechamento)
prices = np.array([...]).reshape(-1, 1) # 60 precos
prices_scaled = scaler.transform(prices)
input_tensor = torch.FloatTensor(prices_scaled.reshape(1, 60, 1))
with torch.no_grad():
prediction = model(input_tensor).item()
predicted_price = scaler.inverse_transform([[prediction]])[0][0]
print(f"Preco previsto: R$ {predicted_price:.2f}")Deploy This Model
Production-ready deployment in minutes
Together.ai
Instant API access to this model
Production-ready inference API. Start free, scale to millions.
Try Free APIReplicate
One-click model deployment
Run models in the cloud with simple API. No DevOps required.
Deploy NowDisclosure: We may earn a commission from these partners. This helps keep LLMYourWay free.