# -- CRAN examples begin --
library(h2o)
localH2O = h2o.init()
# Run GLM of CAPSULE ~ AGE + RACE + PSA + DCAPS
prostatePath = system.file("extdata", "prostate.csv", package = "h2o")
prostate.hex = h2o.importFile(localH2O, path = prostatePath, key = "prostate.hex")
prostate.glm = h2o.glm(y = "CAPSULE", x = c("AGE","RACE","PSA","DCAPS"), data = prostate.hex,
family = "binomial", nfolds = 0, alpha = 0.5, lambda_search = FALSE,
use_all_factor_levels = FALSE, variable_importances = FALSE,
higher_accuracy = FALSE)
# Change coefficient for AGE variable to 0.5
coeff = prostate.glm@model$coefficients
coeff["AGE"] = 0.5
prostate.glm2 = h2o.makeGLMModel(model = prostate.glm, beta = coeff)
# -- CRAN examples end --
Run the code above in your browser using DataLab