Switch from volitility to price tomorrow

This commit is contained in:
2026-02-17 19:10:56 -08:00
parent b1a64be367
commit 7ff2f994e0
3 changed files with 8 additions and 5 deletions
+2 -2
View File
@@ -17,7 +17,7 @@ def Predict():
df = features.CleanDF(df)
# Drop our predictor
df.drop('Volatility_5', axis=1, inplace=True)
df.drop('Target_Close_Tomorrow', axis=1, inplace=True)
# Lazy load this so it doesnt interfere with yfinance
from keras.models import load_model
@@ -34,6 +34,6 @@ def Predict():
# 'predictions' will be a 2D array, flatten it if you want a simple list
flat_predictions = predictions.flatten()
print(f"Predicted Volatility: {flat_predictions}")
print(f"Predicted Target_Close_Tomorrow: {flat_predictions}")
return flat_predictions
+2 -2
View File
@@ -16,8 +16,8 @@ def TrainAI():
# Load the dataset
dataset = pd.read_parquet(os.path.join(DATA_DIR, "stocks.parquet"))
X = dataset.drop('Volatility_5', axis=1)
Y = dataset['Volatility_5']
X = dataset.drop('Target_Close_Tomorrow', axis=1)
Y = dataset['Target_Close_Tomorrow']
# Show the datatypes
print(dataset.dtypes)
+3
View File
@@ -23,6 +23,9 @@ def MakeFeatures(df, i):
# Add feature for volitility last 20
df['Volatility_20'] = df['Return'].transform(lambda x: x.rolling(20).std())
# This is our training metric
df['Target_Close_Tomorrow'] = df['Close'].shift(-1).pct_change()
# Return new df with new features
return df