ExplosiveGrowth / src /model.py
MacDash's picture
Create src/model.py
84c4d00 verified
raw
history blame contribute delete
475 Bytes
from sklearn.ensemble import RandomForestClassifier
model = RandomForestClassifier()
def train_model(df):
"""Train the AI model."""
df["target"] = (df["close"].pct_change() > 0.05).astype(int) # Label: 1 if price increased by >5%
features = df[["close", "volume"]].dropna()
target = df["target"].dropna()
model.fit(features[:-1], target)
def predict_growth(latest_data):
"""Predict explosive growth."""
return model.predict([latest_data])