dimnames.xgb.DMatrix | R Documentation |
xgb.DMatrix
Only column names are supported for xgb.DMatrix
, thus setting of
row names would have no effect and returned row names would be NULL.
## S3 method for class 'xgb.DMatrix'
dimnames(x)
## S3 replacement method for class 'xgb.DMatrix'
dimnames(x) <- value
x |
object of class |
value |
a list of two elements: the first one is ignored and the second one is column names |
Generic dimnames
methods are used by colnames
.
Since row names are irrelevant, it is recommended to use colnames
directly.
data(agaricus.train, package='xgboost')
train <- agaricus.train
dtrain <- xgb.DMatrix(train$data, label=train$label, nthread = 2)
dimnames(dtrain)
colnames(dtrain)
colnames(dtrain) <- make.names(1:ncol(train$data))
print(dtrain, verbose=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.