from h2o.estimators import H2OXGBoostEstimator
# Import the titanic dataset into H2O:
titanic = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/gbm_test/titanic.csv")
# Set the predictors and response; set the response as a factor:
titanic["survived"] = titanic["survived"].asfactor()
predictors = titanic.columns
response = "survived"
# Split the dataset into a train and valid set:
train, valid = titanic.split_frame(ratios=[.8], seed=1234)
# Build and train the model:
titanic_xgb = H2OXGBoostEstimator(booster='dart',
normalize_type="tree",
seed=1234)
titanic_xgb.train(x=predictors,
y=response,
training_frame=train,
validation_frame=valid)
# Eval performance:
perf = titanic_xgb.model_performance()
# Generate predictions on a test set (if necessary):
pred = titanic_xgb.predict(valid)
# Extract feature interactions:
feature_interactions = titanic_xgb.feature_interaction()
# Get Friedman and Popescu's H statistics
h = titanic_xgb.h(train, ['fair','age'])
print(h)
Server error java.lang.NullPointerException:
Error: Cannot read field "_key" because "vecs[i]" is null
Request: None
The input parameter validation should be done properly.
This code throws NPE:
The input parameter validation should be done properly.