Skip to content

Commit 0709840

Browse files
authored
Merge pull request #1 from pwcnorthrop/pwcnorthrop-patch-1
BUG: _qmc.py::_random_oa_lhs produces correlated samples
2 parents 77c78ae + 7f43c1d commit 0709840

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

scipy/stats/_qmc.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,7 +1494,8 @@ def _random_oa_lhs(self, n: IntNumber = 4) -> np.ndarray:
14941494
for j in range(n_col):
14951495
perms = self.rng.permutation(p)
14961496
oa_sample_[:, j] = perms[oa_sample[:, j]]
1497-
1497+
1498+
oa_sample = oa_sample_
14981499
# following is making a scrambled OA into an OA-LHS
14991500
oa_lhs_sample = np.zeros(shape=(n_row, n_col))
15001501
lhs_engine = LatinHypercube(d=1, scramble=self.scramble, strength=1,
@@ -1505,8 +1506,6 @@ def _random_oa_lhs(self, n: IntNumber = 4) -> np.ndarray:
15051506
lhs = lhs_engine.random(p).flatten()
15061507
oa_lhs_sample[:, j][idx] = lhs + oa_sample[:, j][idx]
15071508

1508-
lhs_engine = lhs_engine.reset()
1509-
15101509
oa_lhs_sample /= p
15111510

15121511
return oa_lhs_sample[:, :self.d] # type: ignore

0 commit comments

Comments
 (0)