留存率预测:建模用户回访与持续活跃

FreeGuideOnline 最新 2026-06-24

python

伪代码示例:使用 LightGBM 进行分类

import lightgbm as lgb

设置处理不平衡的 scale_pos_weight

pos_weight = (负样本数量 / 正样本数量) model = lgb.LGBMClassifier( objective='binary', scale_pos_weight=pos_weight, n_estimators=200, num_leaves=31, learning_rate=0.05 ) model.fit(X_train, y_train, eval_set=[(X_val, y_val)])