R : matrix and dgCMatrix got different predict result?
I am using the same matrix and dgCMatrix as input but I got different result in R.
my code was below
data(agaricus.train, package='xgboost')
data(agaricus.test, package='xgboost')
train <- agaricus.train
test <- agaricus.test
bst <- xgboost(data = train$data, label = train$label, max_depth = 2,
eta = 1, nthread = 2, nrounds = 2, objective = "binary:logistic")
pred <- predict(bst, test$data)
m <- as.matrix(test$data)
pred_matrix = predict(bst,m)
pred[1:3]
# [1] 0.2858302 0.9239239 0.2858302
pred_matrix[1:3]
# [1] 0.01241208 0.01241208 0.01241208
`
# R version 3.3.2 (2016-10-31)
# Platform: x86_64-w64-mingw32/x64 (64-bit)
# Running under: Windows 7 x64 (build 7601) Service Pack 1
#
# locale:
# [1] LC_COLLATE=Chinese (Simplified)_People's Republic of China.936
# [2] LC_CTYPE=Chinese (Simplified)_People's Republic of China.936
# [3] LC_MONETARY=Chinese (Simplified)_People's Republic of China.936
# [4] LC_NUMERIC=C
# [5] LC_TIME=Chinese (Simplified)_People's Republic of China.936
#
# attached base packages:
# [1] stats graphics grDevices utils datasets methods base
#
# other attached packages:
# [1] Matrix_1.2-8 xgboost_0.6-4 RcppRoll_0.2.2 futile.logger_1.4.3
# [5] logging_0.7-103