1

我正在编写用于交叉验证模型性能的代码。为了随机拆分数据集,我使用此方法:

h2o.runif(train.hex) 

不幸的是,它总是返回相同的向量:

0.7309678 0.2405364 0.6374174 0.5504370 0.5975453 0.3332184

我也尝试过使用不同的种子,例如:

h2o.runif(train.hex, seed=-1)

h2o.runif(train.hex, seed=123)

结果总是一样的。功能有什么问题?我将不胜感激任何提示。

更新

这是一个完整的代码:

library(h2o)
localH2O <- h2o.init(nthreads = -1,max_mem_size = '7g')
data(iris)
iris.hex<- as.h2o(localH2O,iris)
random <- h2o.runif(iris.hex, seed=-1) 
print(random)
4

1 回答 1

0

我无法重现该问题。

library(h2o)
localH2O <- h2o.init(nthreads = -1, max_mem_size = '7g')
data(iris)
iris.hex <- as.h2o(localH2O, iris)

random <- h2o.runif(iris.hex, seed=-1) 
print(random)

产生:

        rnd
1 0.4668078
2 0.9952272
3 0.7743285
4 0.1585492
5 0.2527465
6 0.9686618

但是,如果我再次运行它,它会产生不同的东西(如预期的那样):

        rnd
1 0.1059295
2 0.2621405
3 0.1191477
4 0.3412595
5 0.3589089
6 0.9686884
于 2015-12-17T04:51:59.367 回答