清华镜像源安装 NGboost XGboost Catboost
pip install catboost -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install ngboost -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install xgboost -i https://pypi.tuna.tsinghua.edu.cn/simple
数据比赛常用预测模型:LGB、XGB与ANN
LGB
lightgbm:由于现在的比赛数据越来越大,想要获得一个比较高的预测精度,同时又要减少内存占用以及提升训练速度,lightgbm是一个非常不错的选择,其可达到与xgboost相似的预测效果。
def LGB_predict(train_x,train_y,test_x,res,index):
print("LGB test")
clf = lgb.LGBMClassifier(
boosting_type='gbdt', num_leaves=31, reg_alpha=0.0, reg_lambda=1,
max_depth=-1, n_estimators=5000, objective='binary',
subsample=0.7, colsample_bytree=0.7, subsample_freq=1,
learning_rate=0.05, min_child_weight=50, random_state=2018, n_jobs=-1
)
clf.fit(train_x, train_y, eval_set=[(train_x, train_y)], eval_metric='auc',early_stopping_rounds=100)
res['score'+str(index)] = clf.predict_proba(test_x)[:,1]
res['score'+str(index)] = res['score'+str(index)].apply(lambda x: float('%.6f' % x))
print(str(index)+' predict finish!')
gc.collect()
res=res.reset_index(drop=True)
return res['score'+str(index)