Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/0xdata/h2o
Browse files Browse the repository at this point in the history
  • Loading branch information
raoariel committed Aug 4, 2014
2 parents 312a081 + c16aac1 commit f45629d
Show file tree
Hide file tree
Showing 15 changed files with 1,961 additions and 1,779 deletions.
32 changes: 0 additions & 32 deletions R/h2o-package/R/Algorithms.R
Original file line number Diff line number Diff line change
Expand Up @@ -205,38 +205,6 @@ h2o.glm <- function(x, y, data, key = "", family, nfolds = 0, alpha = 0.5, nlamb
variable_importances = variable_importances, use_all_factor_levels = use_all_factor_levels)
}

.get.glm.model <- function(data, model_key, return_all_lambda = TRUE) {
res <- .h2o.__remoteSend(data@h2o, .h2o.__PAGE_GLMModelView, '_modelKey'=model_key)
params <- res$glm_model$parameters
params$h2o <- data@h2o
resModel <- res$glm_model
destKey <- resModel$'_key'

model.make<-
function(x, data, model_key, return_all_lambda) {
m <- .h2o.__getGLMResults(data@h2o, model_key, x, FALSE, "", data)
res_xval <- list()
if(!is.null(resModel$submodels[[x]]$xvalidation)) {
xvalKeys <- resModel$submodels[[x]]$xvalidation$xval_models
if(!is.null(xvalKeys) && length(xvalKeys) >= 2) {
for (i in 1:length(xvalKeys)) {
res_xval[[i]] <- .get.glm.model(data, xvalKeys[[i]], return_all_lambda)
}
}
}
new("H2OGLMModel", key = model_key, data = data, model = m, xval = res_xval)
}

if(return_all_lambda) {
return_all_lambda <<- FALSE
models <- lapply(1:length(resModel$submodels), model.make, data, model_key, return_all_lambda)
best_model <- resModel$best_lambda_idx+1
return(new("H2OGLMModelList", models = models, best_model = best_model))
} else {
return(model.make(resModel$best_lambda_idx+1, data, resModel, model_key, return_all_lambda))
}
}

.h2o.glm2grid.internal <- function(x_ignore, y, data, key, family, nfolds, alpha, nlambda, lambda.min.ratio, lambda, epsilon, standardize, prior, tweedie.p, iter.max, higher_accuracy, lambda_search, return_all_lambda,
variable_importances, use_all_factor_levels) {
if(family == "tweedie")
Expand Down
Loading

0 comments on commit f45629d

Please sign in to comment.