I am using R's implementation of XGboost and Random forest to generate 1-day ahead forecasts for revenue. I have about 200 rows and 50 predictors. (As I go further in time I have more data so more rows).
The XGBoost model with the below parameters is 6% worse than an off the shelf random forest model with respect to the mean square error. Furthermore, the random forest model is slightly more accurate than an autoregressive time series forecast model. (I haven't tried Arimax yet tbh).
For Xgboost, I tried changing eta to 0.02 and num_rounds to 8,000, but now it takes a long time to run. Is there some kind of guide that I can use to improve the forecast accuracy of the xgboost model? Am I using the multi-core feature properly?
I feel as though I am reaching around in the dark with marginal payoff. If it helps, I am using a core I7 with 12gb of ram, running Windows 7 Professional. I appreciate your assistance!
rf.mod = randomForest(act ~ ., data = train)
rf.pred = predict(rf.mod, newdata = test)
#####################################
train_x <- sparse.model.matrix(~., data = train[,2:ncol(train)])
train_y <- train$act
test_x <- sparse.model.matrix(~., data = test)
xgtrain <- xgb.DMatrix(data = train_x, label= train_y)
xgtest <- xgb.DMatrix(data = test_x)
num_rounds <- 1000
evalgini <- function(preds, dtrain) {
labels <- getinfo(dtrain, "label")
err <- NormalizedGini(as.numeric(labels),as.numeric(preds))
return(list(metric = "Gini", value = err))
}
param <- list("objective" = "reg:linear",
"eta" = 0.2,
"min_child_weight" = 5,
"subsample" = .8,
"colsample_bytree" = .8,
"scale_pos_weight" = 1.0,
"max_depth" = 8)
xg.mod <- xgb.train(params = param, data = xgtrain, feval = evalgini, nround=num_rounds, print.every.n = num_rounds, maximize = TRUE)
xg.pred <- predict(xg.mod ,xgtest)