How is the parameter "weight" (DMatrix) used in the gradient boosting procedure (xgboost)?

Viewed 20026

In xgboost it is possible to set the parameter weight for a DMatrix. This is apparently a list of weights wherein each value is a weight for a corresponding sample. I can't find any information on how these weights are actually used in the gradient boosting procedure. Are they related to eta ?

For example, if I would set weight to 0.3 for all samples and eta to 1, would this be the same as setting eta to 0.3 and weight to 1?

2 Answers

weight in xgboost's DMatrix is the only correct way to enter exposure variable (e.g. insurance policy duration) for Poisson-distributed targets, e.g. insurance claims frequency (i.e. when 'objective': 'count:poisson').

More info

So what are the incorrect ways? Contrary to replies on Stack Exchange, base_margin and set_base_margin. I benchmarked all these three options against GLM's sample_weight (exposed by PoissonRegressor's fit method), and only weight produced similarly unbiased models (as seen from actual vs. predicted plots for individual features). Not to mention the early stopping metrics (Poisson negative log-likehood or RMSE) being markedly improved (lower) by switching to weight (down to the level that improves over GLM).

Related