DLLEXPORT void XGBoosterUpdateInteract( void *handle, void *dtrain, const char *action ){ Booster *bst = static_cast<Booster*>(handle); DMatrix *dtr = static_cast<DMatrix*>(dtrain); bst->CheckInit(); dtr->CheckInit(); std::string act( action ); bst->UpdateInteract( act, *dtr ); }
DLLEXPORT void XGBoosterBoostOneIter( void *handle, void *dtrain, float *grad, float *hess, size_t len, int bst_group ){ Booster *bst = static_cast<Booster*>(handle); DMatrix *dtr = static_cast<DMatrix*>(dtrain); bst->CheckInit(); dtr->CheckInit(); bst->BoostOneIter( *dtr, grad, hess, len, bst_group ); }
// xgboost implementation DLLEXPORT void *XGBoosterCreate( void *dmats[], size_t len ){ std::vector<xgboost::regrank::DMatrix*> mats; for( size_t i = 0; i < len; ++i ){ DMatrix *dtr = static_cast<DMatrix*>(dmats[i]); dtr->CheckInit(); log_debug("XGBoosterCreate: * i=%u", (unsigned int)i); mats.push_back( dtr ); log_debug("XGBoosterCreate: ** i=%u", (unsigned int)i); } log_debug("XGBoosterCreate: xxxx"); log_debug("XGBoosterCreate: mats=%u", (unsigned int)mats.size()); void *booster = new Booster( mats ); log_debug("XGBoosterCreate: booster=%p", booster); return booster; }
DLLEXPORT void XGBoosterUpdateOneIter( void *handle, void *dtrain ){ Booster *bst = static_cast<Booster*>(handle); DMatrix *dtr = static_cast<DMatrix*>(dtrain); bst->CheckInit(); dtr->CheckInit(); bst->UpdateOneIter( *dtr ); }