使用这两种方法对轻型gbm分类器有何区别?

我想正确使用某些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)

为什么要立即训练?

xieyijin 回答:使用这两种方法对轻型gbm分类器有何区别?

LightGBM具有一些不同的API,它们具有不同的方法名称(LGBMClassifier,Booster,train等),参数以及有时是不同类型的数据,这就是为什么train方法不需要调用LGBMClassifier而是需要另一种类型的原因数据集。没有正确/错误/标准的方法-如果使用得当,它们都很好。 https://lightgbm.readthedocs.io/en/latest/Python-API.html#training-api

本文链接:https://www.f2er.com/3152341.html

大家都在问