Skip to content

Commit

Permalink
Updated tests and doc/requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
rmj3197 committed Apr 29, 2024
1 parent 4f0648a commit f2fe8de
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
10 changes: 9 additions & 1 deletion QuadratiK/ui/pages/3_K_Sample_Test.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,15 @@ def run_ksample_test(h_val, num_iter, b, X, y):
k_samp_test.vn_h0_rejected_,
]
res = res.set_axis(
["Test Type", "Un Test Statistic", "Un Critical Value", "Un Reject H0","Vn Test Statistic", "Vn Critical Value", "Vn Reject H0"]
[
"Test Type",
"Un Test Statistic",
"Un Critical Value",
"Un Reject H0",
"Vn Test Statistic",
"Vn Critical Value",
"Vn Reject H0",
]
)
st.table(res)
csv_res = res.to_csv().encode()
Expand Down
2 changes: 1 addition & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ sphinx-autobuild>=2021.0
sphinx-book-theme>=1.0
nbsphinx>0.9
ipykernel
QuadratiK
git+https://github.com/rmj3197/QuadratiK.git
15 changes: 10 additions & 5 deletions tests/test_kernel_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ def test_normality(self):
normality_test_numpy = KernelTest(h=0.5, random_state=42).test(x)
normality_test_dataframe = KernelTest(h=0.5, random_state=42).test(dataframe_x)
self.assertFalse(normality_test_numpy.un_h0_rejected_)
self.assertTrue(isinstance(normality_test_numpy.un_test_statistic_, (int, float)))
self.assertTrue(
isinstance(normality_test_numpy.un_test_statistic_, (int, float))
)
self.assertFalse(normality_test_dataframe.un_h0_rejected_)
self.assertTrue(
isinstance(normality_test_dataframe.un_test_statistic_, (int, float))
)
self.assertEqual(
normality_test_numpy.un_h0_rejected_, normality_test_dataframe.un_h0_rejected_
normality_test_numpy.un_h0_rejected_,
normality_test_dataframe.un_h0_rejected_,
)
self.assertEqual(
normality_test_numpy.un_test_statistic_,
Expand Down Expand Up @@ -95,19 +98,21 @@ def test_ksample(self):
h=1.5, method="subsampling", b=0.5, random_state=42
).test(x, y)
self.assertFalse(k_sample_test.un_h0_rejected_)
self.assertTrue(isinstance(k_sample_test.un_test_statistic_, np.ndarray))
self.assertTrue(isinstance(k_sample_test.un_test_statistic_,(int,float)))

k_sample_test_without_h = KernelTest(
method="subsampling", b=0.5, random_state=42, alternative="location"
).test(x, y)
self.assertFalse(k_sample_test_without_h.un_h0_rejected_)
self.assertTrue(isinstance(k_sample_test_without_h.un_test_statistic_, np.ndarray))
self.assertTrue(
isinstance(k_sample_test_without_h.un_test_statistic_,(int,float))
)

k_sample_test_1d = KernelTest(
h=1.5, method="subsampling", b=0.5, random_state=42
).test(x_1d, y_dataframe)
self.assertFalse(k_sample_test_1d.un_h0_rejected_)
self.assertTrue(isinstance(k_sample_test_1d.un_test_statistic_, np.ndarray))
self.assertTrue(isinstance(k_sample_test_1d.un_test_statistic_, (int,float)))

with self.assertRaises(ValueError):
KernelTest(h=1.5, method="subsampling", b=0.5, random_state=42).test(
Expand Down

0 comments on commit f2fe8de

Please sign in to comment.