lightgbm训练模型代码
核心概念界定import lightgbm as lgb
import pandas as pd
def lgb_train(x_train, y_train, x_test, y_test):
clf = lgb.LGBMClassifier(
boosting_type='gbdt',
# num_leaves=31,
num_leaves=31,
reg_alpha=0.05,罗德曼
reg_lambda=1.5,
max_depth=-1,
n_estimators=1200,
objective='binary',
subsample=0.85,
物流成本管理
colsample_bytree=0.8,
subsample_freq=1,蒜黄怎么做好吃
恋爱秘籍
learning_rate=0.035,
# min_child_weight=0.1,
min_child_samples=25,
ed=2021,
nthread=-1)我想吃屎
clf.fit(X, y, eval_metric='auc', verbo=True, eval_t=[(x_train,y_train),(x_test,y_test)], early_stopping_rounds=5,categorical_feature='auto')
y_pred = clf.predict_proba(x_test)[:, 1]
auc = roc_auc_score(y_test, y_pred)
print(f"lgb-auc: {auc}")氨甲环酸说明书
importance = pd.Series(data=clf.feature_importances_, index=feature_col, name=("colname", "importance")).sort_values(
ascending=Fal).to_frame()
<_csv('import.csv')黄山的景色
return clf