xgboost (version 0.3-0)

xgb.DMatrix: Contruct xgb.DMatrix object

Description

Contruct xgb.DMatrix object from dense matrix, sparse matrix or local file.

Usage

xgb.DMatrix(data, info = list(), missing = 0, ...)

Arguments

data
a matrix object, a dgCMatrix object or a character indicating the data file.
info
a list of information of the xgb.DMatrix object
missing
Missing is only used when input is dense matrix, pick a float
...
other information to pass to info.

Examples

Run this code
data(iris)
iris[,5] <- as.numeric(iris[,5])
dtrain <- xgb.DMatrix(as.matrix(iris[,1:4]), label=iris[,5])
xgb.DMatrix.save(dtrain, 'iris.xgb.DMatrix')
dtrain <- xgb.DMatrix('iris.xgb.DMatrix')

Run the code above in your browser using DataCamp Workspace