H2o.ensemble:family< - " gaussian",with family = gamma的错误需要肯定的响应

时间:2017-08-02 14:32:45

标签: r gaussian h2o ensemble-learning

h2o.ensemble中的错误(x = x,y = y,training_frame = train,family = family,:family = gamma需要正面响应 回溯:

  1. h2o.ensemble(x = x,y = y,training_frame = train,family = family, 。 learner = learner,metalearner = metalearner,cvControl = list(V = 5, 。 shuffle = TRUE))
  2. 停止(" family = gamma需要积极响应")
  3. 响应" y"同时具有消极和正面价值。

    ## Load required packages
    library(h2o)
    library(h2oEnsemble)
    
    h2o.init(nthreads = -1, max_mem_size = "8G")
    
    data <- h2o.importFile('./input/df_train.csv')
    
    # Partition the data into train and test sets
    splits <- h2o.splitFrame(data, seed = 1)
    train <- splits[[1]]
    test <- splits[[2]]
    
    # Identify response and predictor variables
    y <- "logerror"
    x <- setdiff(colnames(data), c(y, "parcelid", "transactiondate"))
    print(x)
    
    
    # Specify the base learner library & the metalearner
    learner <- c("h2o.glm.wrapper", "h2o.randomForest.wrapper", 
                "h2o.xgboost.wrapper",
                "h2o.gbm.wrapper", "h2o.deeplearning.wrapper")
    metalearner <- "h2o.glm.wrapper"
    family <- "gaussian"
    
    # Train the ensemble using 5-fold CV to generate level-one data
    
    fit <- h2o.ensemble(x = x, y = y,
                    training_frame = train,
                    family = family,
                    learner = learner,
                    metalearner = metalearner,
                    cvControl = list(V = 5, shuffle = TRUE))
    
    # Evaluate performance on a test set
    perf <- h2o.ensemble_performance(fit, newdata = test)
    perf
    

1 个答案:

答案 0 :(得分:0)

这是 h2oEnsemble v0.2.0中的一个错误,当我添加对额外family值(gamma,poisson等)的支持时引入了该错误。我有fixed the bug并发布了 h2oEnsemble v0.2.1;您可以找到下载新包here的链接,或使用下面的R命令:

install.packages("https://h2o-release.s3.amazonaws.com/h2o-ensemble/R/h2oEnsemble_0.2.1.tar.gz", repos = NULL)

另外,您的代码尝试使用包装器"h2o.xgboost.wrapper"来包含XGBoost模型 - h2oEnsemble 包中没有内置的XGBoost包装器,所以不会工作。我将在 h2o 3.14.0.1发布后添加XGBoost包装器。这应该发生在下一周或两周。