kingabzpro commited on
Commit
a09d8a6
1 Parent(s): facab2e

Sync App files

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -99,6 +99,9 @@ class StockPredictor:
99
  data["day"] = data["date"].dt.day
100
  data["ma_5"] = data["close"].rolling(window=5).mean()
101
  data["ma_10"] = data["close"].rolling(window=10).mean()
 
 
 
102
 
103
  # Drop rows with NaN values created by rolling window
104
  data.dropna(inplace=True)
@@ -128,7 +131,7 @@ class StockPredictor:
128
  data = self.load_stock_data(ticker)
129
 
130
  # Define features
131
- features = ["year", "month", "day", "ma_5", "ma_10"]
132
 
133
  # Predict the actual values in the dataset
134
  X_actual = data[features]
 
99
  data["day"] = data["date"].dt.day
100
  data["ma_5"] = data["close"].rolling(window=5).mean()
101
  data["ma_10"] = data["close"].rolling(window=10).mean()
102
+ # Adding lag features
103
+ data["lag_5"] = data["close"].shift(5)
104
+ data["lag_10"] = data["close"].shift(10)
105
 
106
  # Drop rows with NaN values created by rolling window
107
  data.dropna(inplace=True)
 
131
  data = self.load_stock_data(ticker)
132
 
133
  # Define features
134
+ features = ["year", "month", "day", "ma_5", "ma_10", "lag_5", "lag_10"]
135
 
136
  # Predict the actual values in the dataset
137
  X_actual = data[features]