好的,下面是一段用 LightGBM 做回归的示例代码:
import lightgbmas lgb
# 读入数据
X_train, y_train = read_data()
X_test, y_test = read_data()
# 创建 LightGBM 训练数据集
lgb_train = lgb.Dataset(X_train, y_train)
lgb_eval = lgb.Dataset(X_test, y_test, reference=lgb_train)
# 定义参数
params = {
'boosting_type': 'gbdt',