| xgb.gblinear.history | R Documentation |
A helper function to extract the matrix of linear coefficients' history from a gblinear model created while using the xgb.cb.gblinear.history callback (which must be added manually as by default it is not used).
xgb.gblinear.history(model, class_index = NULL)
model |
Either an |
class_index |
zero-based class index to extract the coefficients for only that
specific class in a multinomial multiclass model. When it is |
Note that this is an R-specific function that relies on R attributes that
are not saved when using XGBoost's own serialization functions like xgb.load()
or xgb.load.raw().
In order for a serialized model to be accepted by this function, one must use R
serializers such as saveRDS().
For an xgb.train() result, a matrix (either dense or sparse) with the columns
corresponding to iteration's coefficients and the rows corresponding to boosting iterations.
For an xgb.cv() result, a list of such matrices is returned with the elements
corresponding to CV folds.
When there is more than one coefficient per feature (e.g. multi-class classification)
and class_index is not provided,
the result will be reshaped into a vector where coefficients are arranged first by features and
then by class (e.g. first 1 through N coefficients will be for the first class, then
coefficients N+1 through 2N for the second class, and so on).
xgb.cb.gblinear.history, coef.xgb.Booster.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.