将Tibble转换为h2o十六进制文件时出现错误

时间:2018-07-31 11:36:41

标签: machine-learning rstudio h2o h2o4gpu

我正在Rstudio中运行h2o软件包,将Tibble转换为h2o时出现错误。

下面是我的代码

#Augment Time Series Signature
PO_Data_aug = PO_Data %>%
  tk_augment_timeseries_signature()

PO_Data_aug


# Split into training, validation and test sets
train_tbl = PO_Data_aug %>% filter(Date <= '2017-12-29')
valid_tbl = PO_Data_aug %>% filter(Date>'2017-12-29'& Date <='2018-03-31')
test_tbl  = PO_Data_aug %>% filter(Date > '2018-03-31')
str(train_tbl)
train_tbl$month.lbl<-as.character(train_tbl$month.lbl)

h2o.init()        # Fire up h2o

##hex
train_h2o = as.h2o(train_tbl)
valid_h2o = as.h2o(valid_tbl)
test_h2o  = as.h2o(test_tbl)



ERROR: Unexpected HTTP Status code: 412 Precondition Failed (url = http://localhost:54321/3/Parse)



ERROR MESSAGE:

Provided column type ordered is unknown.  Cannot proceed with parse due to invalid argument.

亲切建议

2 个答案:

答案 0 :(得分:1)

这实际上是H2O中的错误-与小动作无关。在data.frames或tibbles中不支持“有序”列类型。我们将修复此(ticket here)

目前的解决方法是将“有序”列手动转换为无序“因数”列。

tb <- tibble(x = ordered(c(1,2,3)), y = 1:3)
tb$x <- factor(tb$x, ordered = FALSE)
hf <- as.h2o(tb)

答案 1 :(得分:0)

as.h2o()需要R数据帧。您可以使用R数据框而不是小标题数据框,或者如汤姆在评论中所述,可以将supported文件格式之一用于H2O。

train_h2o = as.h2o(as_data_frame(train_tbl))
valid_h2o = as.h2o(as_data_frame(valid_tbl))
test_h2o  = as.h2o(as_data_frame(test_tbl))