Hack-R Hack-R - 1 month ago 13
R Question

H2O XGBoost on Windows: Error: java.lang.UnsatisfiedLinkError: ml.dmlc.xgboost4j.java.XGBoostJNI.XGDMatrixCreateFromCSREx([J[I[FI[J)I

When I try to run XGboost in R on Windows 7 and on Windows Server 2008R2 via

h2o.xgboost()
with H2O 3.12.01 I get the following error:


Error: java.lang.UnsatisfiedLinkError:
ml.dmlc.xgboost4j.java.XGBoostJNI.XGDMatrixCreateFromCSREx([J[I[FI[J)I


Here's a reproducible example:

library(h2o)
h2o.init(nthreads = -1)
h2o.no_progress() # Don't show progress bars in RMarkdown output

# Import a sample binary outcome train/test set into H2O
train <- h2o.importFile("https://s3.amazonaws.com/erin-data/higgs/higgs_train_10k.csv")
test <- h2o.importFile("https://s3.amazonaws.com/erin-data/higgs/higgs_test_5k.csv")

# Identify predictors and response
y <- "response"
x <- setdiff(names(train), y)

# For binary classification, response should be a factor
train[,y] <- as.factor(train[,y])
test[,y] <- as.factor(test[,y])

# Number of CV folds (to generate level-one data for stacking)
nfolds <- 5

# Train & Cross-validate a (shallow) XGB-GBM
my_xgb1 <- h2o.xgboost(x = x,
y = y,
training_frame = train,
distribution = "bernoulli",
ntrees = 50,
max_depth = 3,
min_rows = 2,
learn_rate = 0.2,
nfolds = nfolds,
fold_assignment = "Modulo",
keep_cross_validation_predictions = TRUE,
seed = 1)



R version 3.4.0 Patched (2017-05-19 r72713)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server 2008 R2 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252

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

other attached packages:
[1] h2o_3.12.0.1

loaded via a namespace (and not attached):
[1] compiler_3.4.0 tools_3.4.0 RCurl_1.95-4.8 jsonlite_1.5 bitops_1.0-6



3.12.01 was the newest development version linked on the h2o.ai homepage, which I upgraded to after not finding this function in 3.10. However, a comment by @MarcoSandri indicated there's a newer development version (3.13) on their Amazon AWS, so downloaded it and upgraded the cluster and R package accordingly.

The upgrade from 3.12 to 3.13 seemed to go smoothly, until I attempted to use the
h2o.xgboost()
function. Then it threw a different error:

Error in .h2o.doSafeREST(h2oRestApiVersion = h2oRestApiVersion, urlSuffix = page, :



ERROR MESSAGE:

-1

Error in fetch(key) :
lazy-load database 'E:/Program Files/R/R-3.4.0patched/library/h2o/help/h2o.rdb' is corrupt


Answer Source

Windows is not supported with H2O-3 XGBoost. For referenc, here is a list of OS's supported by H2O-3 XGBoost: http://docs.h2o.ai/h2o/latest-stable/h2o-docs/data-science/xgboost.html#limitations

-Navdeep