xgb.DMatrix.save: Save xgb.DMatrix object to binary file

Description Usage Arguments Examples

View source: R/xgb.DMatrix.save.R

Description

Save xgb.DMatrix object to binary file

Usage

1
xgb.DMatrix.save(dmatrix, fname)

Arguments

dmatrix

the xgb.DMatrix object

fname

the name of the file to write.

Examples

1
2
3
4
5
6
data(agaricus.train, package='xgboost')
train <- agaricus.train
dtrain <- xgb.DMatrix(train$data, label=train$label)
xgb.DMatrix.save(dtrain, 'xgb.DMatrix.data')
dtrain <- xgb.DMatrix('xgb.DMatrix.data')
if (file.exists('xgb.DMatrix.data')) file.remove('xgb.DMatrix.data')

Example output

[1] TRUE
[23:01:11] 6513x126 matrix with 143286 entries loaded from xgb.DMatrix.data
[1] TRUE

xgboost documentation built on April 22, 2021, 5:06 p.m.