demo/poisson_regression.R

data(mtcars)
head(mtcars)
bst <- xgboost(data = as.matrix(mtcars[, -11]), label = mtcars[, 11],
               objective = 'count:poisson', nrounds = 5)
pred <- predict(bst, as.matrix(mtcars[, -11]))
sqrt(mean((pred - mtcars[, 11]) ^ 2))

Try the xgboost package in your browser

Any scripts or data that you put into this service are public.

xgboost documentation built on May 29, 2024, 5:11 a.m.