Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seed for latin hypercube #16

Open
iamholger opened this issue Nov 7, 2017 · 2 comments
Open

Seed for latin hypercube #16

iamholger opened this issue Nov 7, 2017 · 2 comments

Comments

@iamholger
Copy link

Hi,
I am playing with the latin hypercube samper and was wondering if there is
a way to set the random seed somewhere.
Thanks,
Holger

@willblatt
Copy link

Calling np.random.seed() before each call should do it.

>>> import numpy as np
>>> import pyDOE
>>> pyDOE.lhs(2, 5)
array([[ 0.70104734,  0.67737853],
       [ 0.04406124,  0.24034865],
       [ 0.52808135,  0.06996526],
       [ 0.95872749,  0.91600084],
       [ 0.2935575 ,  0.49661397]])
>>> pyDOE.lhs(2, 5)
array([[ 0.37079506,  0.6130573 ],
       [ 0.70104922,  0.29884737],
       [ 0.5693123 ,  0.81930618],
       [ 0.88562447,  0.15706703],
       [ 0.03688797,  0.4159291 ]])
>>> np.random.seed(2)
>>> pyDOE.lhs(2, 5)
array([[ 0.64092973,  0.28706448],
       [ 0.48407356,  0.85336546],
       [ 0.3099325 ,  0.00518525],
       [ 0.08719898,  0.46606696],
       [ 0.85993093,  0.72385419]])
>>> np.random.seed(2)
>>> pyDOE.lhs(2, 5)
array([[ 0.64092973,  0.28706448],
       [ 0.48407356,  0.85336546],
       [ 0.3099325 ,  0.00518525],
       [ 0.08719898,  0.46606696],
       [ 0.85993093,  0.72385419]])

@judejeh
Copy link

judejeh commented Sep 25, 2021

The above does not seem to work (anymore). pyDOE2 has an option to pass a 'random_state' value though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants