kid / advanced_model.py
nastaseshot's picture
advanced_model.py
3830529 verified
# advanced_model.py
import lightgbm as lgb
import pandas as pd
import joblib
def train_advanced_model(dataframe, model_path="advanced_model.lgb"):
X = dataframe.drop(columns=["success"])
y = dataframe["success"]
model = lgb.LGBMClassifier(
n_estimators=300,
learning_rate=0.05,
max_depth=6,
subsample=0.8,
colsample_bytree=0.8,
random_state=42
)
model.fit(X, y)
joblib.dump(model, model_path)
print("[AdvancedModel] Model trained and saved.")
def predict_token_advanced(features, model_path="advanced_model.lgb"):
model = joblib.load(model_path)
df = pd.DataFrame([features])
proba = model.predict_proba(df)[0][1]
return proba