我想正确使用某些Light gbm功能。
这是标准方法,与sklearn的任何其他分类器没有区别:
- 定义X,y
- train_test_split
- 创建分类器
- 适合火车
- 预测测试
-
比较
X_train,X_test,y_train,y_test = train_test_split(X,y,test_size=0.25) #here maybe DecisionTreeclassifier(),RandomForestClassifier() etc model = lgb.LGBMClassifier() model.fit(X_train,y_train) predicted_y = model.predict(X_test) print(metrics.classification_report())
但是light gbm具有自己的功能,例如lgb.Dataset,Booster。
但是,在this kaggle notebook中,它根本没有调用LightGBMClassifier! 为什么?
以lgbm方法调用lgbm函数和训练模型的标准顺序是什么?
X_train,test_size=0.25)
#why need this Dataset wrapper around x_train,y_train?
d_train = lgbm.Dataset(X_train,y_train)
#where is light gbm classifier()?
bst = lgbm.train(params,d_train,50,early_stopping_rounds=100)
preds = bst.predict(y_test)
为什么要立即训练?