I'm working on a project and we are using XGBoost to make predictions. My colleague sent me the model file but when I load on my computer it don't run as expected.

When I changed one variable from the model from 0 to 1 it didn't changed the result (in 200 different lines), so I started to investigate. We compared a lot of different results and it was all different.

I run the xgb_tree it showed the max_depth is 0, but it is supposed to be 4. When I run xgb_tree$results it says the max_depth = 4.

We also tried a lot of different save methods (.rda, .rds, .model) but none of them worked.

Any suggestion would be welcome, thanks.

EDIT: Posting the sessionInfo()


R version 3.2.5 (2016-04-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] plyr_1.8.4            car_2.1-4             acepack_1.4.1         Ckmeans.1d.dp_3.4.6-4
 [5] Hmisc_4.0-0           Formula_1.2-1         survival_2.40-1       memisc_0.99.7-1      
 [9] MASS_7.3-45           Information_0.0.9     minerva_1.4.5         randomForest_4.6-12  
[13] pROC_1.8              xgboost_0.4-4         caret_6.0-73          lattice_0.20-33      
[17] ggplot2_2.2.0         miscTools_0.6-22      reshape_0.8.6         data.table_1.9.8     
[21] dplyr_0.5.0           e1071_1.6-7           lubridate_1.6.0       psych_1.6.9          
[25] readr_1.0.0           stringr_1.1.0         stringi_1.1.2        

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.8         class_7.3-14        assertthat_0.1      digest_0.6.10      
 [5] foreach_1.4.3       R6_2.2.0            MatrixModels_0.4-1  stats4_3.2.5       
 [9] lazyeval_0.2.0      minqa_1.2.4         SparseM_1.74        nloptr_1.0.4       
[13] rpart_4.1-10        Matrix_1.2-4        labeling_0.3        splines_3.2.5      
[17] lme4_1.1-12         foreign_0.8-66      munsell_0.4.3       compiler_3.2.5     
[21] mnormt_1.5-5        mgcv_1.8-12         htmltools_0.3.5     nnet_7.3-12        
[25] tibble_1.2          gridExtra_2.2.1     htmlTable_1.7       codetools_0.2-14   
[29] ModelMetrics_1.1.0  grid_3.2.5          nlme_3.1-125        gtable_0.2.0       
[33] DBI_0.5-1           magrittr_1.5        scales_0.4.1        reshape2_1.4.2     
[37] doParallel_1.0.10   latticeExtra_0.6-28 RColorBrewer_1.1-2  iterators_1.0.8    
[41] tools_3.2.5         parallel_3.2.5      pbkrtest_0.4-6      colorspace_1.3-1   
[45] cluster_2.0.3       knitr_1.15.1        quantreg_5.29


R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

[1] LC_COLLATE=Portuguese_Brazil.1252  LC_CTYPE=Portuguese_Brazil.1252    LC_MONETARY=Portuguese_Brazil.1252
[4] LC_NUMERIC=C                       LC_TIME=Portuguese_Brazil.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] caret_6.0-73         ggplot2_2.1.0        lattice_0.20-33      plyr_1.8.4           xgboost_0.4-4       
[6] shinydashboard_0.5.3 shiny_0.14.2        

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.8        nloptr_1.0.4       iterators_1.0.8    tools_3.3.1        digest_0.6.10      lme4_1.1-12       
 [7] jsonlite_1.1       nlme_3.1-128       gtable_0.2.0       mgcv_1.8-12        Matrix_1.2-6       foreach_1.4.3     
[13] parallel_3.3.1     SparseM_1.72       stringr_1.1.0      MatrixModels_0.4-1 stats4_3.3.1       grid_3.3.1        
[19] nnet_7.3-12        data.table_1.9.6   R6_2.1.3           minqa_1.2.4        reshape2_1.4.2     car_2.1-3         
[25] magrittr_1.5       scales_0.4.0       codetools_0.2-14   ModelMetrics_1.1.0 htmltools_0.3.5    MASS_7.3-45       
[31] splines_3.3.1      rsconnect_0.4.3    pbkrtest_0.4-6     mime_0.5           xtable_1.8-2       colorspace_1.2-6  
[37] httpuv_1.3.3       quantreg_5.29      stringi_1.1.1      munsell_0.4.3      chron_2.3-47      
  • 2
    $\begingroup$ Could you add the output of sessionInfo() of your computer and your colleagues? This will give us some insights into the configuration and package versions. $\endgroup$
    – Stereo
    Commented Jan 3, 2017 at 13:48

1 Answer 1


The error was due to the R version. My colleague was running a 3.2.5 and I was running the 3.3.1, and thanks to Stereo I could notice this and test on the same versions.

  • $\begingroup$ No problem, feel free to vote for my question :) $\endgroup$
    – Stereo
    Commented Jan 3, 2017 at 17:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.