-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from sdaza/dev
additional testing
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import pytest | ||
from experiment_utils.power_sim import PowerSim | ||
from experiment_utils.spark_instance import * | ||
|
||
|
||
def test_power_estimation(): | ||
"""Test power estimation""" | ||
p = PowerSim(metric='proportion', relative_effect=False, variants=1, | ||
nsim=1000, alpha=0.05, alternative='two-tailed') | ||
try: | ||
p.get_power(baseline=[0.33], effect=[0.03], sample_size=[3000]) | ||
assert True | ||
except Exception as e: | ||
pytest.fail(f" raised an exception: {e}") | ||
|
||
|
||
def test_plot_power(): | ||
"""Test plot power""" | ||
p = PowerSim(metric='proportion', relative_effect=False, | ||
variants=2, alternative='two-tailed', | ||
nsim=100, correction='holm') | ||
try: | ||
p.grid_sim_power(baseline_rates=[[0.33]], | ||
effects=[[0.01, 0.03], [0.03, 0.05], [0.03, 0.07]], | ||
sample_sizes=[[1000], [5000], [9000]], | ||
threads=16, | ||
plot=True) | ||
assert True | ||
except Exception as e: | ||
pytest.fail(f" raised an exception: {e}") |