h2o.runif() always returns the same vector

188 views Asked by At

I am writing the code for cross validation of my models' performance.In order to split data set randomly I use this method:

h2o.runif(train.hex) 

Unfortunately it always returns me the same vector:

0.7309678 0.2405364 0.6374174 0.5504370 0.5975453 0.3332184

I've also tried to use different seeds e.g.:

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

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

the results are always the same. What is wrong with function? I would appreciate for any hint on it.

UPDATE

Here is a full code:

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)
1

There are 1 answers

0
Erin LeDell On

I can't reproduce the problem.

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)

Produces:

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

However, if I run it again, it produces something different (as expected):

        rnd
1 0.1059295
2 0.2621405
3 0.1191477
4 0.3412595
5 0.3589089
6 0.9686884