1

I'm trying to execute the Cross-Validation for the boosting regression/classification trees using the function gbm.step() from the R package dismo, but it returns a empty output and I can't figure out why. This is the code I'm using:

ColIndexCov <- match(names(myRS),colnames(DFbrt_df2))
ColIndexResp <- match(c("HasRes"),colnames(DFbrt_df2))
DFbrt_df <- DFbrt@data
DFbrt_df2 <- na.omit(DFbrt_df)
  myBRT = gbm.step(data=DFbrt_df2, 
                   gbm.x = ColIndexCov, 
                   gbm.y = ColIndexResp,
                   tree.complexity = 3,
                   learning.rate = 10^(-8),
                   n.trees = 50,
                   family = "bernoulli",
                   n.folds = 4,
                   fold.vector = DFbrt_df2$Region.num,
                   step.size = 50,
                   verbose = F,
                   silent = T
  )

str(DFbrt_df2)
'data.frame':   560845 obs. of  18 variables:
 $ Nsamples  : num  310 310 310 310 310 310 310 310 310 310 ...
 $ cluster   : num  39 39 39 39 39 39 39 39 39 39 ...
 $ R         : num  44.9 44.9 44.9 44.9 44.9 ...
 $ P50       : num  0.565 0.544 0.609 0.605 0.593 ...
 $ regions   : Factor w/ 6 levels "China_east","China_middlesouth",..: 1 1 1 1 1 1 1 1 1 1 ...
 $ HasRes    : num  1 0 1 0 0 0 1 1 0 0 ...
 $ use       : num  10.02 9.75 0 9.38 8.77 ...
 $ acc       : num  0 0 0.4103 0.0769 0.0779 ...
 $ tmp       : num  2.46 2.46 2.46 2.46 2.45 ...
 $ irg       : num  1.788 0.399 1.205 1.836 1.841 ...
 $ PgExt     : num  3.11 0 3.7 3.11 3.18 ...
 $ PgInt     : num  4.69 2.76 0 3.99 2.22 ...
 $ ChExt     : num  3.74 0 4.33 3.74 3.81 ...
 $ ChInt     : num  5.01 5.99 5.35 4.88 4.97 ...
 $ Ca        : num  0 0 2.71 0 2.8 ...
 $ veg       : num  0 0 0 0 0 0 0 0 0 0 ...
 $ Region.num: num  4 4 4 4 4 4 4 4 4 4 ...
 $ Region    : num  4 4 4 4 4 4 4 4 4 4 ...
 - attr(*, "na.action")= 'omit' Named int  1 2 3 4 5 6 7 8 9 10 ...
  ..- attr(*, "names")= chr  "1" "2" "3" "4" ...

the answer variable is the variable HasRes and the covariates are the variables use, acc, tmp, irg, PgExt, PgInt, ChExt, ChInt, ca, veg.

G0904B
  • 43
  • 3

0 Answers0