Skip to content

Commit

Permalink
Updated repo
Browse files Browse the repository at this point in the history
  • Loading branch information
sharief2UIUC committed May 31, 2024
2 parents 2d9e0fa + 06a47f4 commit 3e291ff
Show file tree
Hide file tree
Showing 14 changed files with 81 additions and 109 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
**__pycache__
**_version.py
**_version.py
**.gz
**.ipynb_checkpoints
**ubyte
Binary file removed data/MNIST/raw/t10k-images-idx3-ubyte
Binary file not shown.
Binary file removed data/MNIST/raw/t10k-images-idx3-ubyte.gz
Binary file not shown.
Binary file removed data/MNIST/raw/t10k-labels-idx1-ubyte
Binary file not shown.
Binary file removed data/MNIST/raw/t10k-labels-idx1-ubyte.gz
Binary file not shown.
Binary file removed data/MNIST/raw/train-images-idx3-ubyte
Binary file not shown.
Binary file removed data/MNIST/raw/train-images-idx3-ubyte.gz
Binary file not shown.
Binary file removed data/MNIST/raw/train-labels-idx1-ubyte
Binary file not shown.
Binary file removed data/MNIST/raw/train-labels-idx1-ubyte.gz
Binary file not shown.
33 changes: 10 additions & 23 deletions notebooks/mnist.ipynb

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions notebooks/test.ipynb

Large diffs are not rendered by default.

106 changes: 46 additions & 60 deletions notebooks/time_series.ipynb

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions src/pqm/pqm.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,13 @@ def pqm_chi2(
pqm_chi2(x_samples, y_samples, num_refs=num_refs, whiten=whiten)
for _ in range(bootstrap)
]
if bootstrap is not None:
return [pqm_chi2(x_samples, y_samples, num_refs=num_refs) for _ in range(bootstrap)]
chi2_stat, _, dof, _ = _pqm_test(x_samples, y_samples, num_refs, whiten)
if dof != num_refs - 1:
# Rescale chi2 to new value which has the same cumulative probability
cp = chi2.sf(chi2_stat, dof)
chi2_stat = chi2.isf(cp, num_refs - 1)
if chi2_stat / dof < 10:
cp = chi2.sf(chi2_stat, dof)
chi2_stat = chi2.isf(cp, num_refs - 1)
else:
chi2_stat = chi2_stat * (num_refs - 1) / dof
dof = num_refs - 1
return chi2_stat, dof
return chi2_stat, dof
2 changes: 1 addition & 1 deletion tests/test_gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ def test_fail_chi2():

new.append(pqm_chi2(x_samples, y_samples, num_refs=100))
new = np.array(new)
assert np.mean(new[:, 0]) / 99 > 10
assert np.mean(new[:, 0]) / 99 > 2

0 comments on commit 3e291ff

Please sign in to comment.