jtassos2025 commited on
Commit
c7d8567
·
1 Parent(s): 8b08e9e

numpy as np

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -64,10 +64,12 @@ def prepare_input_sequence(df, x_scaler, seq_len=90):
64
  def prepare_unified_input_sequence(df, x_scaler, seq_len, ticker_idx, num_tickers):
65
  features = df[["Open", "High", "Low", "Close", "Volume"]].values
66
  X_scaled = x_scaler.transform(features)
67
- onehot = torch.eye(num_tickers)[ticker_idx].numpy()
68
  onehot_seq = np.repeat(onehot.reshape(1, -1), seq_len, axis=0)
69
  X_full = np.hstack([X_scaled[-seq_len:], onehot_seq])
70
- return torch.tensor(X_full, dtype=torch.float32).unsqueeze(0).to(DEVICE)
 
 
71
 
72
  # ------------------------
73
  # Load Models
 
64
  def prepare_unified_input_sequence(df, x_scaler, seq_len, ticker_idx, num_tickers):
65
  features = df[["Open", "High", "Low", "Close", "Volume"]].values
66
  X_scaled = x_scaler.transform(features)
67
+ onehot = np.eye(num_tickers)[ticker_idx]
68
  onehot_seq = np.repeat(onehot.reshape(1, -1), seq_len, axis=0)
69
  X_full = np.hstack([X_scaled[-seq_len:], onehot_seq])
70
+ X_tensor = torch.tensor(X_full, dtype=torch.float32).unsqueeze(0).to(DEVICE)
71
+ return X_tensor
72
+
73
 
74
  # ------------------------
75
  # Load Models