Skip to content

Commit b575094

Browse files
author
Snigdha Panigrahi
committed
made same test
1 parent 29d2ceb commit b575094

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

selectinf/randomized/tests/test_selective_MLE_high.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ def test_full_targets(n=200,
8383
return pval[beta[nonzero] == 0], pval[beta[nonzero] != 0], coverage, intervals
8484

8585

86-
def test_selected_targets(n=2000,
86+
def test_selected_targets(seedn,
87+
n=2000,
8788
p=200,
8889
signal_fac=1.2,
8990
s=5,
@@ -99,6 +100,7 @@ def test_selected_targets(n=2000,
99100
signal = np.sqrt(signal_fac * 2 * np.log(p))
100101

101102
while True:
103+
np.random.seed(seed=seedn)
102104
X, Y, beta = inst(n=n,
103105
p=p,
104106
signal=signal,
@@ -317,9 +319,8 @@ def main(nsim =50):
317319

318320
n, p, s = 500, 100, 5
319321
for i in range(nsim):
320-
np.random.seed(seed=i)
321322
full_dispersion = True
322-
mle, lower_conf, upper_conf = test_selected_targets(n=n, p=p, s=s, signal_fac=1.2, full_dispersion=full_dispersion)
323+
mle, lower_conf, upper_conf = test_selected_targets(n=n, p=p, s=s, signal_fac=1.2, full_dispersion=full_dispersion, seedn=i)
323324
#print("check ", mle, lower_conf, upper_conf)
324325
DF["MLE"] = pd.Series(mle)
325326
DF["Lower Conf"] = pd.Series(lower_conf)
@@ -331,11 +332,11 @@ def main(nsim =50):
331332
import os
332333
outpath = os.path.dirname(__file__)
333334

334-
outfile_mse_html = os.path.join(outpath, "compare_mle.html")
335-
outfile_mse_csv = os.path.join(outpath, "compare_mle.csv")
335+
outfile_mse_html = os.path.join(outpath, "compare_mle_old.html")
336+
outfile_mse_csv = os.path.join(outpath, "compare_mle_old.csv")
336337

337338
master_DF.to_html(outfile_mse_html, index=False)
338339
master_DF.to_csv(outfile_mse_csv, index=False)
339340

340341
if __name__ == "__main__":
341-
main(nsim=50)
342+
main(nsim=50)

0 commit comments

Comments
 (0)